Skip to content

Commit 7d482c5

Browse files
committed
chore: Add release-please to automate releases
1 parent 65136a3 commit 7d482c5

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

.github/workflows/release-please.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
on:
2+
push:
3+
branches:
4+
- main
5+
name: release-please
6+
jobs:
7+
release-please:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: GoogleCloudPlatform/release-please-action@v2
11+
id: release
12+
with:
13+
release-type: node
14+
package-name: test-release-please
15+
# The logic below handles the npm publication:
16+
- uses: actions/checkout@v3
17+
# these if statements ensure that a publication only occurs when
18+
# a new release is created:
19+
if: ${{ steps.release.outputs.release_created }}
20+
- uses: actions/setup-node@v3
21+
with:
22+
node-version: 16
23+
registry-url: 'https://registry.npmjs.org'
24+
if: ${{ steps.release.outputs.release_created }}
25+
- run: npm ci
26+
if: ${{ steps.release.outputs.release_created }}
27+
- run: npm publish
28+
env:
29+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
30+
if: ${{ steps.release.outputs.release_created }}
31+
32+
# Tweets out release announcement
33+
- 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 }}"'
34+
if: ${{ steps.release.outputs.release_created }}
35+
env:
36+
TWITTER_CONSUMER_KEY: ${{ secrets.TWITTER_CONSUMER_KEY }}
37+
TWITTER_CONSUMER_SECRET: ${{ secrets.TWITTER_CONSUMER_SECRET }}
38+
TWITTER_ACCESS_TOKEN_KEY: ${{ secrets.TWITTER_ACCESS_TOKEN_KEY }}
39+
TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}

0 commit comments

Comments
 (0)