Skip to content

Commit 265234f

Browse files
committed
Add publish branch workflow to deploy any npm dist-tag from a branch
1 parent 3dd2283 commit 265234f

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

.github/workflows/publish_branch.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Deploy Branch
2+
3+
on: workflow_dispatch
4+
5+
jobs:
6+
deploy:
7+
runs-on: ubuntu-20.04
8+
9+
env:
10+
NPM_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
11+
BROWSERSLIST_IGNORE_OLD_DATA: true
12+
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v3
16+
17+
- name: Use Node.js 16
18+
uses: actions/setup-node@v3
19+
with:
20+
node-version: 16
21+
22+
- name: Get dist-tag from branch name
23+
env:
24+
BRANCH: ${{ github.ref_name }}
25+
id: split
26+
run: echo "branchDescription=${BRANCH##*/}" >> "$GITHUB_OUTPUT"
27+
28+
- name: Fail if no proper branch name
29+
run: |
30+
if test -z "${{ steps.split.outputs.branchDescription }}"; then
31+
echo "Failed as no proper branch name was provided. Please use the format of prefix/branch-description."
32+
exit 1
33+
fi
34+
35+
- name: pnpm cache
36+
uses: actions/cache@v3
37+
with:
38+
path: ./common/temp/pnpm-store
39+
key: ${{ runner.os }}-pnpm-${{ hashFiles('common/config/rush/pnpm-lock.yaml') }}
40+
restore-keys: ${{ runner.os }}-pnpm-
41+
42+
- name: Rush Install
43+
run: node common/scripts/install-run-rush.js install
44+
45+
- name: Setup git
46+
uses: oleksiyrudenko/[email protected]
47+
with:
48+
token: '${{ secrets.GITHUB_TOKEN }}'
49+
name: github-actions[bot]
50+
email: 41898282+github-actions[bot]@users.noreply.github.com
51+
52+
- name: Rush Version
53+
run: node common/scripts/install-run-rush.js version --bump --ignore-git-hooks --override-prerelease-id dev --override-bump prerelease
54+
55+
- name: Rush Build
56+
run: node common/scripts/install-run-rush.js rebuild --verbose
57+
58+
- name: Rush Test
59+
run: node common/scripts/install-run-rush.js test --verbose
60+
61+
- name: Rush Publish
62+
env:
63+
BRANCH_DESCRIPTION: ${{ steps.split.outputs.branchDescription }}
64+
run: node common/scripts/install-run-rush.js publish --apply --include-all --publish --tag $BRANCH_DESCRIPTION --set-access-level public --ignore-git-hooks

0 commit comments

Comments
 (0)