Skip to content

Commit ee1305f

Browse files
ci: add release-please for automated releases (#64)
* ci: add release-please for automated releases Add release-please to automate versioning, changelog generation, and npm publishing on merge to main. Mirrors the setup in authkit-nextjs. * Update .github/workflows/release-please.yml Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> --------- Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
1 parent e73adba commit ee1305f

4 files changed

Lines changed: 52 additions & 14 deletions

File tree

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Release Please
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
id-token: write
12+
13+
jobs:
14+
release-please:
15+
runs-on: ubuntu-latest
16+
outputs:
17+
release_created: ${{ steps.release.outputs.release_created }}
18+
steps:
19+
- name: Generate token
20+
id: generate-token
21+
uses: actions/create-github-app-token@v2
22+
with:
23+
app-id: ${{ vars.SDK_BOT_APP_ID }}
24+
private-key: ${{ secrets.SDK_BOT_PRIVATE_KEY }}
25+
26+
- uses: googleapis/release-please-action@v4
27+
id: release
28+
with:
29+
token: ${{ steps.generate-token.outputs.token }}
30+
31+
publish:
32+
needs: release-please
33+
if: ${{ needs.release-please.outputs.release_created == 'true' }}
34+
uses: ./.github/workflows/release.yml

.github/workflows/release.yml

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
name: Release
22

33
on:
4-
# Support manually pushing a new release
5-
workflow_dispatch: {}
6-
# Trigger when a release is published
7-
release:
8-
types: [published]
4+
workflow_dispatch:
5+
workflow_call:
96

107
defaults:
118
run:
@@ -37,12 +34,5 @@ jobs:
3734
run: |
3835
pnpm run build
3936
40-
- name: Push Release
41-
if: ${{ !github.event.release.prerelease }}
42-
run: |
43-
pnpm publish --tag latest --access=public --no-git-checks --provenance
44-
45-
- name: Push Pre-Release
46-
if: ${{ github.event.release.prerelease }}
47-
run: |
48-
pnpm publish --tag next --access=public --no-git-checks --provenance
37+
- name: Publish
38+
run: pnpm publish --tag latest --access=public --provenance --no-git-checks

.release-please-manifest.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
".": "0.5.0"
3+
}

release-please-config.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
3+
"include-component-in-tag": false,
4+
"packages": {
5+
".": {
6+
"release-type": "node",
7+
"changelog-path": "CHANGELOG.md",
8+
"versioning": "default"
9+
}
10+
}
11+
}

0 commit comments

Comments
 (0)