Skip to content

Commit a283514

Browse files
authored
branch release (#49)
1 parent d1e6a42 commit a283514

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Branch Release
2+
3+
on:
4+
push
5+
6+
jobs:
7+
publish-npm:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v4
11+
12+
- name: Set up Node.js
13+
uses: actions/setup-node@v4
14+
with:
15+
node-version: "20"
16+
registry-url: https://registry.npmjs.org/
17+
18+
- name: Install Bun
19+
run: |
20+
curl -fsSL https://bun.sh/install | bash
21+
echo "$HOME/.bun/bin" >> $GITHUB_PATH
22+
23+
- name: Cache node modules
24+
uses: actions/cache@v4
25+
with:
26+
path: |
27+
node_modules
28+
src/playground/node_modules
29+
~/.bun/install/cache
30+
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }}
31+
restore-keys: |
32+
${{ runner.os }}-bun-
33+
34+
- name: Install & Build Root Project
35+
run: bun install --frozen-lockfile
36+
37+
- name: Install & Build Playground
38+
working-directory: src/playground
39+
run: bun install --frozen-lockfile
40+
41+
- name: Build Full Project
42+
run: bun run build
43+
44+
- name: Set Version from Branch
45+
run: |
46+
BRANCH_NAME=${GITHUB_REF#refs/heads/}
47+
BRANCH_NAME=${BRANCH_NAME//\//-} # Replace slashes with dashes
48+
SHORT_SHA=$(git rev-parse --short HEAD)
49+
BASE_VERSION="0.1.0" # Define a base version
50+
VERSION="${BASE_VERSION}-${BRANCH_NAME}-${SHORT_SHA}"
51+
npm version $VERSION --no-git-tag-version
52+
53+
- name: Publish
54+
run: |
55+
if [[ "${GITHUB_REF#refs/tags/}" == *-* ]]; then
56+
npm publish --access public --tag beta
57+
else
58+
npm publish --access public
59+
fi
60+
env:
61+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

0 commit comments

Comments
 (0)