Merge pull request #65 from bcgov/dependabot/npm_and_yarn/docs/multi-… #44
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 to GH Pages | |
on: | |
push: | |
branches: | |
- v4 | |
- v5 | |
release: | |
types: | |
- published | |
env: | |
notifyBCDocVersion_PATH: / | |
ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }} | |
ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }} | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Update notifyBCDocVersion_PATH for releases | |
if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
run: echo notifyBCDocVersion_PATH=/version/$(echo $GITHUB_REF | cut -d / -f 3 | cut -d v -f 2- | cut -d . -f 1,2)/ >> $GITHUB_ENV | |
- name: Update notifyBCDocVersion_PATH for non-main branches | |
if: ${{ github.ref_type == 'branch' && github.ref_name != 'main'}} | |
run: echo notifyBCDocVersion_PATH=/preview/ >> $GITHUB_ENV | |
- name: Checkout 🛎️ | |
uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ vars.NODE_VERSION }} | |
- name: Install and Build 🔧 # This example project is built using npm and outputs the result to the 'build' folder. Replace with the commands required to build your project, or remove this step entirely if your site is pre-built. | |
run: | | |
cd docs | |
npm ci | |
npm run build | |
- name: Deploy 🚀 | |
uses: JamesIves/github-pages-deploy-action@3.7.1 | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
BRANCH: gh-pages # The branch the action should deploy to. | |
FOLDER: docs/.vuepress/dist # The folder the action should deploy. | |
TARGET_FOLDER: ${{ env.notifyBCDocVersion_PATH }} | |
CLEAN: true # Automatically remove deleted files from the deploy branch | |
CLEAN_EXCLUDE: '["version"]' |