Skip to content

Commit

Permalink
feat(workflows): update release-documentation.yaml workflow to use ne…
Browse files Browse the repository at this point in the history
…tlify.config.json data
  • Loading branch information
oliverschuerch committed Jul 8, 2024
1 parent 495fdb6 commit 3e4f960
Showing 1 changed file with 23 additions and 14 deletions.
37 changes: 23 additions & 14 deletions .github/workflows/release-documentation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,42 +16,51 @@ on:
concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
release:
name: Release Documentation
check-version:
name: Check Version
runs-on: ubuntu-latest
outputs:
changed: ${{ steps.check.outputs.changed }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Check if version has changed
id: check # This will be the reference for getting the outputs.
uses: EndBug/version-check@v2 # You can choose the version/branch you prefer.
id: check
uses: EndBug/version-check@v2
with:
file-name: ./packages/documentation/package.json
diff-search: true
token: ${{ secrets.GITHUB_TOKEN }}

release:
name: Release Documentation
runs-on: ubuntu-latest
needs: check-version
if: needs.check-version.outputs.changed == 'true'
steps:
- name: Setup
if: steps.check.outputs.changed == 'true'
uses: ./.github/actions/setup-pnpm

- name: Install documentation & dependencies
if: steps.check.outputs.changed == 'true'
run: pnpm --filter "design-system-documentation..." install

- name: Build documentation & dependencies
if: steps.check.outputs.changed == 'true'
run: pnpm --filter "design-system-documentation..." build

- name: Install netlify cli
if: steps.check.outputs.changed == 'true'
run: pnpm -g i netlify-cli@15
run: pnpm -g i netlify-cli

- name: Get netlify config
id: netlify-config
uses: actions/github-script@v7
with:
script: |
const fs = require('fs')
return JSON.parse(fs.readFileSync('./packages/documentation/netlify.config.json', 'utf8'))
- name: Publish documentation to netlify
if: steps.check.outputs.changed == 'true'
env:
NETLIFY_SITE_ID: ${{ secrets.NEXT_NETLIFY_SITE_ID }}
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
run: |
netlify link --id $NETLIFY_SITE_ID
netlify deploy --build false --dir packages/documentation/storybook-static --prod
NETLIFY_SITE_ID: ${{ fromJSON(steps.netlify-config.outputs.result).siteId }}
run: netlify deploy --filter @swisspost/design-system-documentation --build false --dir packages/documentation/storybook-static --prod

0 comments on commit 3e4f960

Please sign in to comment.