52 lines
1.3 KiB
YAML
52 lines
1.3 KiB
YAML
name: Deploy to gh-pages
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches: [main]
|
|
paths:
|
|
- simulator
|
|
- web
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Use Node.js 20
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 20
|
|
|
|
- name: Cache node modules
|
|
id: cache-npm
|
|
uses: actions/cache@v3
|
|
env:
|
|
cache-name: cache-node-modules
|
|
with:
|
|
# npm cache files are stored in `~/.npm` on Linux/macOS
|
|
path: ~/.npm
|
|
key: ${{ hashFiles('**/package-lock.json') }}
|
|
|
|
- name: Install
|
|
run: npm install
|
|
|
|
- name: CD
|
|
run: |
|
|
git config --global user.name $user_name
|
|
git config --global user.email $user_email
|
|
git remote set-url origin https://${github_token}@github.com/${repository}
|
|
./stamp.sh
|
|
npm run build
|
|
npm run -w web deploy
|
|
VERSION=$(grep version package.json | awk -F\" '{print $4}')
|
|
git tag "$VERSION" main
|
|
git push origin "$VERSION"
|
|
git push origin main
|
|
env:
|
|
user_name: "github-actions[bot]"
|
|
user_email: "github-actions[bot]@users.noreply.github.com"
|
|
github_token: ${{ secrets.ACTIONS_DEPLOY_ACCESS_TOKEN }}
|
|
repository: ${{ github.repository }}
|