Skip to content

Commit d2f8ada

Browse files
authored
chore: add release please (#15)
* chore: add release please * Update package.json * chore: add publish step * chore: add prerelease
1 parent bb0f9f7 commit d2f8ada

File tree

2 files changed

+78
-0
lines changed

2 files changed

+78
-0
lines changed

.github/workflows/pre-release.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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 github-actions@github.com
38+
- name: Run npm version
39+
run: npm version ${{ steps.extract.outputs.version }}-${{ steps.extract.outputs.tag }} --allow-same-version
40+
- name: Push changes
41+
run: git push --follow-tags
42+
- name: Run npm publish
43+
run: npm publish --tag=${{ steps.extract.outputs.tag }}
44+
env:
45+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

.github/workflows/release-please.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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@v2
16+
id: release
17+
with:
18+
token: ${{ steps.get-token.outputs.token }}
19+
release-type: node
20+
package-name: "gatsby-plugin-netlify"
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+
- run: npm publish
31+
if: ${{ steps.release.outputs.release_created }}
32+
env:
33+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

0 commit comments

Comments
 (0)