Skip to content

Commit 7fd1e46

Browse files
OHRM5X-2546: Automate tagging the latest build in npm registry (#772)
1 parent c44bc35 commit 7fd1e46

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

.github/workflows/npm-tag.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Tag Latest
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
tag:
10+
if: github.repository == 'orangehrm/oxd'
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
15+
- name: Check version already published
16+
run: |
17+
set -x
18+
npm -v
19+
current_version=$(npm pkg get version | sed 's/"//g')
20+
fetched_current_version=$(npm show @ohrm/oxd@$current_version version) || fetched_current_version=''
21+
echo "current_version=$current_version" >> $GITHUB_ENV
22+
echo "fetched_current_version=$fetched_current_version" >> $GITHUB_ENV
23+
echo "current_published_version=$(npm show @ohrm/oxd version)" >> $GITHUB_ENV
24+
25+
- name: Tag as latest
26+
run: |
27+
current_version=${{ env.current_version }}
28+
npm dist-tag add @ohrm/oxd@$current_version latest
29+
env:
30+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)