From 7b39f7aa4cc81655c151078bce6da8a28419c668 Mon Sep 17 00:00:00 2001 From: Frazer Smith Date: Mon, 24 Feb 2025 20:15:28 +0000 Subject: [PATCH] ci: migrate to manifest config --- .github/release-please/config.json | 20 +++++++ .github/release-please/mainfest.json | 1 + .github/workflows/release-please.yml | 79 +++++++++++++++++----------- 3 files changed, 69 insertions(+), 31 deletions(-) create mode 100644 .github/release-please/config.json create mode 100644 .github/release-please/mainfest.json diff --git a/.github/release-please/config.json b/.github/release-please/config.json new file mode 100644 index 0000000..86597c0 --- /dev/null +++ b/.github/release-please/config.json @@ -0,0 +1,20 @@ +{ + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json", + "release-type": "node", + "prerelease": false, + "include-component-in-tag": false, + "changelog-sections": [ + { "type": "feat", "section": "๐ŸŒŸ Features", "hidden": false }, + { "type": "fix", "section": "๐Ÿฉน Fixes", "hidden": false }, + { "type": "docs", "section": "๐Ÿ“š Documentation", "hidden": false }, + + { "type": "chore", "section": "๐Ÿงน Chores", "hidden": false }, + { "type": "perf", "section": "๐Ÿงน Chores", "hidden": false }, + { "type": "refactor", "section": "๐Ÿงน Chores", "hidden": false }, + { "type": "test", "section": "๐Ÿงน Chores", "hidden": false }, + + { "type": "build", "section": "๐Ÿค– Automation", "hidden": false }, + { "type": "ci", "section": "๐Ÿค– Automation", "hidden": true } + ], + "packages": { ".": {} } +} \ No newline at end of file diff --git a/.github/release-please/mainfest.json b/.github/release-please/mainfest.json new file mode 100644 index 0000000..0ce82eb --- /dev/null +++ b/.github/release-please/mainfest.json @@ -0,0 +1 @@ +{".":"3.0.1"} \ No newline at end of file diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index e743e84..dceec16 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -4,40 +4,57 @@ on: - main name: release-please -permissions: - id-token: write # to enable use of OIDC for npm provenance jobs: release-please: + name: Create/Update Release Pull Request runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + outputs: + release_created: ${{ steps.release.outputs.release_created }} + major: ${{ steps.release.outputs.major }} + minor: ${{ steps.release.outputs.minor }} + patch: ${{ steps.release.outputs.patch }} steps: - - uses: GoogleCloudPlatform/release-please-action@v2 - id: release - with: - release-type: node - package-name: test-release-please - # The logic below handles the npm publication: - - uses: actions/checkout@v4 - # these if statements ensure that a publication only occurs when - # a new release is created: - if: ${{ steps.release.outputs.release_created }} - - uses: actions/setup-node@v4 - with: - node-version: 18 - registry-url: 'https://registry.npmjs.org' - if: ${{ steps.release.outputs.release_created }} - - run: npm ci - if: ${{ steps.release.outputs.release_created }} - - run: npm publish --provenance - env: - NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} - if: ${{ steps.release.outputs.release_created }} + - name: Release Please + id: release + uses: googleapis/release-please-action@v4 + with: + config-file: .github/release-please/config.json + manifest-file: .github/release-please/manifest.json - # Tweets out release announcement - - run: 'npx @humanwhocodes/tweet "${{ github.event.repository.full_name }} v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}.${{ steps.release.outputs.patch }} has been released!\n\n${{ github.event.repository.html_url }}/releases/tag/v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}.${{ steps.release.outputs.patch }}"' - if: ${{ steps.release.outputs.release_created }} - env: - TWITTER_CONSUMER_KEY: ${{ secrets.TWITTER_CONSUMER_KEY }} - TWITTER_CONSUMER_SECRET: ${{ secrets.TWITTER_CONSUMER_SECRET }} - TWITTER_ACCESS_TOKEN_KEY: ${{ secrets.TWITTER_ACCESS_TOKEN_KEY }} - TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }} + publish-npm: + name: Publish to NPM + needs: release-please + if: needs.release-please.outputs.release_created == 'true' + runs-on: ubuntu-latest + permissions: + contents: read + id-token: write + steps: + - name: Check out repo + uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Setup Node + uses: actions/setup-node@v4 + with: + check-latest: true + node-version: lts/* + registry-url: https://registry.npmjs.org + + - name: Publish to NPM + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + run: npm publish --access public --provenance + + # Tweets out release announcement + - run: 'npx @humanwhocodes/tweet "${{ github.event.repository.full_name }} v${{ needs.release-please.outputs.major }}.${{ needs.release-please.outputs.minor }}.${{ needs.release-please.outputs.patch }} has been released!\n\n${{ github.event.repository.html_url }}/releases/tag/v${{ needs.release-please.outputs.major }}.${{ needs.release-please.outputs.minor }}.${{ needs.release-please.outputs.patch }}"' + env: + TWITTER_CONSUMER_KEY: ${{ secrets.TWITTER_CONSUMER_KEY }} + TWITTER_CONSUMER_SECRET: ${{ secrets.TWITTER_CONSUMER_SECRET }} + TWITTER_ACCESS_TOKEN_KEY: ${{ secrets.TWITTER_ACCESS_TOKEN_KEY }} + TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}