Library Release #126
This file contains hidden or 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: Library Release | |
| on: | |
| workflow_dispatch: | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| if: github.ref == 'refs/heads/main' | |
| steps: | |
| - name: Load secrets | |
| id: load-secrets | |
| uses: 1password/load-secrets-action@v2.0.0 | |
| with: | |
| export-env: false | |
| env: | |
| OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} | |
| GPG_PASSPHRASE: op://kv_gov-ui-kit_infra/arabot-1_SIGN_CERTS/credential | |
| GPG_PRIVATE_KEY: op://kv_gov-ui-kit_infra/arabot-1_SIGN_CERTS/private_key | |
| ARABOT_PAT_TRIGGER_WORKFLOW: op://kv_gov-ui-kit_infra/GITHUB_PAT/credential | |
| - name: Setup | |
| uses: aragon/gov-ui-kit/.github/actions/setup@main | |
| with: | |
| token: ${{ steps.load-secrets.outputs.ARABOT_PAT_TRIGGER_WORKFLOW }} | |
| - name: Import GPG key | |
| uses: crazy-max/ghaction-import-gpg@v6.3.0 | |
| with: | |
| gpg_private_key: ${{ steps.load-secrets.outputs.GPG_PRIVATE_KEY }} | |
| passphrase: ${{ steps.load-secrets.outputs.GPG_PASSPHRASE }} | |
| git_user_signingkey: true | |
| git_commit_gpgsign: true | |
| - name: Update version and changelog | |
| # Run prettier on CHANGELOG.md file (used for Github release notes) to remove automatic formatting applied by | |
| # changeset as Github does not support soft line breaks. | |
| # (See https://github.com/changesets/changesets/issues/1452, https://github.com/orgs/community/discussions/10981) | |
| run: | | |
| yarn changeset version | |
| yarn prettier --write CHANGELOG.md --print-width 9999999 --ignore-path | |
| env: | |
| GITHUB_TOKEN: ${{ steps.load-secrets.outputs.ARABOT_PAT_TRIGGER_WORKFLOW }} | |
| - name: Create tag | |
| run: yarn changeset tag | |
| - name: Get package version | |
| id: package-version | |
| uses: martinbeentjes/npm-get-version-action@v1.3.1 | |
| - name: Commit changes | |
| run: | | |
| git add --all | |
| git commit -am "Publish v${{ steps.package-version.outputs.current-version}}" | |
| git push --follow-tags | |
| - name: Read changelog updates | |
| id: read-changelog | |
| uses: actions/github-script@v7.0.1 | |
| env: | |
| version: "${{ steps.package-version.outputs.current-version }}" | |
| path: ./CHANGELOG.md | |
| with: | |
| script: | | |
| const readChangelog = require('./.github/workflows/scripts/readChangelog.js'); | |
| readChangelog({ github, context, core }); | |
| - name: Create release | |
| uses: softprops/action-gh-release@v2.3.2 | |
| with: | |
| prerelease: false | |
| tag_name: "v${{ steps.package-version.outputs.current-version}}" | |
| body: ${{ steps.read-changelog.outputs.changes }} | |
| token: ${{ steps.load-secrets.outputs.ARABOT_PAT_TRIGGER_WORKFLOW }} |