Skip to content

Commit

Permalink
Configures deploy on GH Pages on published release
Browse files Browse the repository at this point in the history
  • Loading branch information
baldoalessandro committed Nov 6, 2023
1 parent 678125d commit ef6ca90
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
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: echo "${version=node -p "require('./package.json').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
- run: yarn build
- 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



0 comments on commit ef6ca90

Please sign in to comment.