Merge pull request #1667 from qld-gov-au/dependabot/npm_and_yarn/deve… #464
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
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code, run tests across different versions of node | |
# build the Storybook and deploy it to Github Pages. | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | |
name: Publish Storybook | |
on: | |
push: | |
branches: | |
- master | |
- develop | |
concurrency: | |
group: compile-${{ github.workflow }}-${{ github.ref }} # Recommended if you intend to make multiple deployments in quick succession. | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node: [ '18' ] | |
name: Build and Deploy on Node ${{ matrix.node }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node }} | |
cache: 'npm' | |
always-auth: 'true' | |
registry-url: 'https://nexus.tools.services.qld.gov.au/nexus/repository/npm_all/' | |
- name: npmrc #run on lint step (Which is cached) | |
run: | | |
npm -v | |
node -v | |
cat /home/runner/work/_temp/.npmrc | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NEXUSREADONLY2NPMTOKEN }} | |
- name: Install #run on lint step (Which is cached) | |
run: | # Install packages | |
npm install --prefer-offline --no-audit --ignore-scripts | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NEXUSREADONLY2NPMTOKEN }} | |
# `npm rebuild` will run all those post-install scripts for us. | |
- name: rebuild and prepare | |
run: npm rebuild && npm run prepare --if-present | |
- name: Build 🔧 | |
run: | | |
npm run build | |
- name: Test 🔧 | |
run: | | |
npm run test-ci | |
- name: Build Storybook 🔧 | |
run: | | |
npm run build-storybook-gh | |
- name: Deploy 🚀 | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
BRANCH: gh-pages # The branch the action should deploy to. | |
FOLDER: storybook-static # The folder that the build-storybook script generates files. | |
CLEAN: true # Automatically remove deleted files from the deploy branch | |
TARGET_FOLDER: docs # The folder that we serve our Storybook files from |