-
Notifications
You must be signed in to change notification settings - Fork 1
58 lines (47 loc) · 1.4 KB
/
publish.yaml
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: 🚢 Publish
on:
push:
branches:
- main
jobs:
has-tags:
name: 🏷️ Analyze Tags
runs-on: ubuntu-24.04
outputs:
has-tag: ${{ steps.check-tag-exists.outputs.has-tag }}
steps:
- name: Clone repository
uses: actions/checkout@v4
with:
fetch-tags: true
# ⚠️ This check works only if the tag is pushed alongside the commit
# Please, use `git push && git push --tags` or `git push --follow-tags` (works only for annonated tags)
- name: Check Tag On Commit
id: check-tag-exists
run: |
if [ -n "$(git tag --points-at HEAD)" ]; then
echo "has-tag=true" >> $GITHUB_OUTPUT
else
echo "has-tag=false" >> $GITHUB_OUTPUT
fi
publish:
name: 📦 Publish Packages
needs: has-tags
if: ${{ needs.has-tags.outputs.has-tag == 'true' }}
runs-on: ubuntu-24.04
steps:
- name: Clone repository
uses: actions/checkout@v4
- name: Setup Node and Install Dependencies
uses: ./.github/actions/setup-install
- name: Build
run: yarn build
- name: Authenticate npm
run: ./bin/ci/npm-auth.sh
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish
run: make publish
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}