Deploy to gh-pages #129
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 "$REMOTE" "$VERSION" | |
git push "$REMOTE" 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 }} |