Skip to content

Commit 2f4cad0

Browse files
authored
chore: add release-please (#200)
* chore: add release-please * chore: add release-please * chore: update
1 parent d7b92a1 commit 2f4cad0

File tree

2 files changed

+83
-0
lines changed

2 files changed

+83
-0
lines changed

.github/workflows/pre-release.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: prerelease
2+
on:
3+
push:
4+
branches:
5+
# releases/<tag>/<version>
6+
- releases/*/*
7+
jobs:
8+
prerelease:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
- uses: actions/setup-node@v2
13+
with:
14+
node-version: '*'
15+
cache: 'npm'
16+
check-latest: true
17+
registry-url: 'https://registry.npmjs.org'
18+
- name: Install core dependencies
19+
run: npm ci --no-audit
20+
- name: Extract tag and version
21+
id: extract
22+
run: |-
23+
ref=${{ github.ref }}
24+
branch=${ref:11}
25+
tag_version=${branch:9}
26+
tag=${tag_version%/*}
27+
version=${tag_version##*/}
28+
echo "::set-output name=tag::${tag}"
29+
echo "::set-output name=version::${version}"
30+
- name: Log versions
31+
run: |-
32+
echo tag=${{ steps.extract.outputs.tag }}
33+
echo version=${{ steps.extract.outputs.version }}
34+
- name: Setup git user
35+
run: git config --global user.name github-actions
36+
- name: Setup git email
37+
run: git config --global user.email [email protected]
38+
- name: Run npm version
39+
run:
40+
npm version ${{ steps.extract.outputs.version }}-${{
41+
steps.extract.outputs.tag }} --allow-same-version
42+
- name: Push changes
43+
run: git push --follow-tags
44+
- name: Run npm publish
45+
run: npm publish --tag=${{ steps.extract.outputs.tag }}
46+
env:
47+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

.github/workflows/release-please.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: release-please
2+
on:
3+
push:
4+
branches:
5+
- main
6+
jobs:
7+
release-please:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: navikt/github-app-token-generator@a9cd374e271b8aef573b8c16ac46c44fb89b02db
11+
id: get-token
12+
with:
13+
private-key: ${{ secrets.TOKENS_PRIVATE_KEY }}
14+
app-id: ${{ secrets.TOKENS_APP_ID }}
15+
- uses: GoogleCloudPlatform/release-please-action@v3
16+
id: release
17+
with:
18+
token: ${{ steps.get-token.outputs.token }}
19+
release-type: node
20+
package-name: '@netlify/plugin-gatsby'
21+
- uses: actions/checkout@v2
22+
if: ${{ steps.release.outputs.release_created }}
23+
- uses: actions/setup-node@v2
24+
with:
25+
node-version: '*'
26+
cache: 'npm'
27+
check-latest: true
28+
registry-url: 'https://registry.npmjs.org'
29+
if: ${{ steps.release.outputs.release_created }}
30+
- name: Install dependencies
31+
run: npm ci
32+
if: ${{ steps.release.outputs.release_created }}
33+
- run: npm publish
34+
if: ${{ steps.release.outputs.release_created }}
35+
env:
36+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

0 commit comments

Comments
 (0)