Skip to content

Commit

Permalink
ci: migrate to manifest config
Browse files Browse the repository at this point in the history
  • Loading branch information
Fdawgs committed Feb 24, 2025
1 parent fc0af81 commit 7b39f7a
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 31 deletions.
20 changes: 20 additions & 0 deletions .github/release-please/config.json
Original file line number Diff line number Diff line change
@@ -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": { ".": {} }
}
1 change: 1 addition & 0 deletions .github/release-please/mainfest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{".":"3.0.1"}
79 changes: 48 additions & 31 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

0 comments on commit 7b39f7a

Please sign in to comment.