Publish ModuleSite on gh-pages #158
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: Publish ModuleSite on gh-pages | |
on: | |
# Trigger the workflow on push only for master branch | |
push: | |
branches: | |
- master | |
# Allows to run workflow manually from Actions tab | |
workflow_dispatch: | |
# Sets permissions of GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
# Allow only one concurrent deployment | |
concurrency: | |
group: "pages" | |
cancel-in-progress: true | |
# Default to bash | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.MODULE_FETCH_GITHUB_TOKEN }} | |
steps: | |
- name: Checkout PR | |
uses: actions/checkout@v3 | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
# Globally caches yarn dependencies | |
cache: 'yarn' | |
# TODO: include pages setup action (actions/configure-pages@v2) | |
# when/after cleaning up path prefix weirdness | |
# - name: Setup Pages | |
# id: pages | |
# uses: | |
# with: | |
# # Automatically inject pathPrefix in your Gatsby configuration file. | |
# static_site_generator: gatsby | |
- name: Install Project Dependencies | |
run: yarn install --frozen-lockfile --immutable | |
- name: Build ModuleSite | |
run: yarn run build | |
- name: Upload artifact | |
# packaging static assets and uploading artifact that can be deployed to GitHub Pages | |
# https://github.com/actions/upload-pages-artifact | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
# path to static assets that will be packaged and uploaded | |
path: ./public | |
deploy: | |
needs: build | |
runs-on: ubuntu-latest | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
# action expects artifact named `github-pages` to have been created prior to execution | |
# this is done automatically using `actions/upload-pages-artifact` | |
# https://github.com/actions/deploy-pages | |
uses: actions/deploy-pages@v1 |