Skip to content

Commit 3daa870

Browse files
author
Lukas Holzer
committed
chore: add pre-release flow to it
1 parent f0b8099 commit 3daa870

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-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+
permissions:
11+
id-token: write
12+
contents: write
13+
steps:
14+
- uses: actions/checkout@v3
15+
- uses: actions/setup-node@v3
16+
with:
17+
node-version: lts/*
18+
cache: npm
19+
registry-url: 'https://registry.npmjs.org'
20+
- name: Install core dependencies
21+
run: npm ci --no-audit
22+
- name: Extract tag and version
23+
id: extract
24+
run: |-
25+
ref=${{ github.ref }}
26+
branch=${ref:11}
27+
tag_version=${branch:9}
28+
tag=${tag_version%/*}
29+
version=${tag_version##*/}
30+
echo "tag=${tag}" >> $GITHUB_OUTPUT
31+
echo "version=${version}" >> $GITHUB_OUTPUT
32+
- name: Log versions
33+
run: |-
34+
echo tag=${{ steps.extract.outputs.tag }}
35+
echo version=${{ steps.extract.outputs.version }}
36+
- name: Setup git user
37+
run: git config --global user.name github-actions
38+
- name: Setup git email
39+
run: git config --global user.email [email protected]
40+
- name: Run npm version
41+
run: npm version ${{ steps.extract.outputs.version }}-${{ 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 }} --provenance
46+
env:
47+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

0 commit comments

Comments
 (0)