-
-
Notifications
You must be signed in to change notification settings - Fork 180
38 lines (30 loc) · 1.18 KB
/
publish-branch.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
name: Publish Branch
on:
push:
branches:
- main
- dev
jobs:
release_candidate:
runs-on: ubuntu-latest
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Setup Project
uses: ./.github/actions/setup
- name: Build Project
run: npm run build
- name: Get current package.json version
run: echo "PACKAGE_VERSION=$(npm pkg get version | tr -d '"')" >> $GITHUB_ENV
# get the sort SHA and add it into the environment variables
- name: Setup Branch Release Candidate Version
run: echo "BRANCH_VERSION=$PACKAGE_VERSION-$BRANCH_NAME.${GITHUB_SHA::7}" >> $GITHUB_ENV
- name: Bump version
run: npm version $BRANCH_VERSION --no-git-tag-version --force
- name: Publish a new branch release candidate version
run: npm publish --tag $BRANCH_NAME