Repository navigation
62 lines (53 loc) · 1.64 KB
/
Copy pathrelease.yml
File metadata and controls
62 lines (53 loc) · 1.64 KB
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
name: Release
on:
workflow_dispatch:
push:
branches:
- master
jobs:
auto-tag:
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.event.head_commit.message, 'v')
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Create tag from commit message
run: |
COMMIT_MSG=$(git log -1 --pretty=%B)
if [[ $COMMIT_MSG =~ ^(v[0-9]+\.[0-9]+\.[0-9]+) ]]; then
TAG_NAME="${BASH_REMATCH[1]}"
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag -a "$TAG_NAME" -m "Release $TAG_NAME"
git push origin "$TAG_NAME"
echo "Tag $TAG_NAME created"
else
echo "Invalid version format"
exit 1
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish-npm:
permissions:
contents: read
id-token: write
runs-on: ubuntu-latest
needs: [auto-tag]
if: github.event_name == 'workflow_dispatch' || success()
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
registry-url: "https://registry.npmjs.org/"
- name: Install Lerna Lite
run: pnpm add -g @lerna-lite/cli @lerna-lite/publish
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build
run: npm run build
- name: Publish to NPM
run: lerna publish from-package --yes