diff --git a/.github/workflows/release-documentation.yaml b/.github/workflows/release-documentation.yaml index 9ad3c7f37b..0f80c771e9 100644 --- a/.github/workflows/release-documentation.yaml +++ b/.github/workflows/release-documentation.yaml @@ -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