Version 0.3.0 #10
Workflow file for this run
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 tag on GH Pages | |
on: | |
release: | |
types: [published] | |
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
jobs: | |
# Build the static bundle | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: | |
- 18.x | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v3 | |
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Get version from package.json | |
id: pkg-json-version | |
run: | | |
pkg_version=$(node -p "require('./package.json').version") | |
echo "version=$pkg_version" >> $GITHUB_OUTPUT | |
- name: Ensure version from package.json match GH release tag | |
if: ${{ steps.pkg-json-version.outputs.version != github.event.release.tag_name}} | |
run: | | |
echo "::debug::Version in package.json differ from release version!" | |
exit 1 | |
- run: yarn install --frozen-lockfile | |
# The app will be hosted at https://<github_user>.github.io/<repo_slug>/ | |
# so we need to rewrite relative urls accordingly. | |
- run: yarn build --base=/${{ github.event.repository.name }}/ | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v2 | |
with: | |
path: dist/ | |
# Deploy to GH Pages | |
deploy: | |
needs: build | |
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment | |
permissions: | |
pages: write # to deploy to Pages | |
id-token: write # to verify the deployment originates from an appropriate source | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v2 | |