-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (69 loc) · 2.37 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
59
60
61
62
63
64
65
66
67
68
69
70
71
name: Publish to npm
on:
push:
branches:
- main
- release
- v1
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
ref: ${{ github.event.inputs.commit }}
- uses: pnpm/action-setup@v4
with:
version: 9
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
registry-url: 'https://registry.npmjs.org'
- name: Set NPM variables
id: npm
run: |
BRANCH=${GITHUB_REF##*/}
DIST_TAG=rc
if [[ $BRANCH == "release" ]]; then
DIST_TAG=latest
fi
echo "dist_tag=${DIST_TAG}" >> $GITHUB_OUTPUT
pnpm config list
- name: Install
run: pnpm install
- name: Semantic Release
id: semantic
uses: cycjimmy/semantic-release-action@v4
with:
semantic_version: 24.0.0
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
- name: Release Summary
if: steps.semantic.outputs.new_release_published == 'true'
run: |
echo "### New version v${{ steps.semantic.outputs.new_release_version }} cut" >> $GITHUB_STEP_SUMMARY
echo "commit: ${GITHUB_SHA}, branch/tag: ${GITHUB_REF}" >> $GITHUB_STEP_SUMMARY
echo "${{ steps.semantic.outputs.new_release_notes }}" >> $GITHUB_STEP_SUMMARY
env:
GH_TOKEN: ${{ secrets.ACCESS_TOKEN }}
- name: NPM Publish
if: steps.semantic.outputs.new_release_published == 'true'
run: |
./scripts/update-version.sh ${{ steps.semantic.outputs.new_release_version }}
pnpm publish --no-git-checks --tag ${{ steps.npm.outputs.dist_tag }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: report error
if: steps.semantic.outputs.new_release_published == 'false'
run: |
echo "### No version cut" >> $GITHUB_STEP_SUMMARY
echo "Check Semantic Release output for details"
- name: Clean Github Release for RC
if: ${{ steps.semantic.outputs.new_release_version != '' && contains(steps.semantic.outputs.new_release_version, '-rc.') == false }}
run: ./scripts/clean-rc-releases.sh
env:
GH_TOKEN: ${{ secrets.ACCESS_TOKEN }}