-
Notifications
You must be signed in to change notification settings - Fork 0
118 lines (99 loc) · 3.16 KB
/
Copy pathrelease.yml
File metadata and controls
118 lines (99 loc) · 3.16 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
name: Release
on:
push:
branches:
- main
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN_PUBLIC }}
FORCE_COLOR: '3'
jobs:
release:
name: Create Release PR
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '🚀 release:')"
timeout-minutes: 10
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Generate token
id: auth
uses: actions/create-github-app-token@v3
with:
client-id: ${{ secrets.AUTH_APP_ID }}
private-key: ${{ secrets.AUTH_APP_KEY }}
- name: Setup pnpm
uses: pnpm/action-setup@v5
with:
dest: ${{ runner.temp }}/setup-pnpm
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version-file: .nvmrc
registry-url: https://registry.npmjs.org
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Prepare data for badges
run: |
pnpm run build
pnpm run test:coverage
- name: Run release script
run: npx @localazy/workflow-scripts create-release-pr
env:
GITHUB_TOKEN: ${{ steps.auth.outputs.token }}
publish:
name: Publish to npm
runs-on: ubuntu-latest
if: "contains(github.event.head_commit.message, '🚀 release:')"
timeout-minutes: 10
permissions:
contents: write
id-token: write
steps:
- name: Generate token
id: auth
uses: actions/create-github-app-token@v3
with:
client-id: ${{ secrets.AUTH_APP_ID }}
private-key: ${{ secrets.AUTH_APP_KEY }}
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup pnpm
uses: pnpm/action-setup@v5
with:
dest: ${{ runner.temp }}/setup-pnpm
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version-file: .nvmrc
registry-url: https://registry.npmjs.org
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build
run: pnpm run build
- name: Determine npm tag
id: npm-tag
run: |
VERSION=$(node -p "require('./package.json').version")
if echo "$VERSION" | grep -q '-'; then
echo "tag=${VERSION#*-}" | sed 's/\..*//' >> "$GITHUB_OUTPUT"
else
echo "tag=latest" >> "$GITHUB_OUTPUT"
fi
- name: Publish to npm
run: pnpm publish --no-git-checks --tag ${{ steps.npm-tag.outputs.tag }} --access public --provenance
- name: Create and push git tag
id: git-tag
run: |
VERSION=$(node -p "require('./package.json').version")
git tag "${VERSION}"
git push origin "${VERSION}"
echo "tag=${VERSION}" >> "$GITHUB_OUTPUT"
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
- name: Create GitHub Release
run: npx @localazy/workflow-scripts create-github-release "${{ steps.git-tag.outputs.version }}"
env:
GITHUB_TOKEN: ${{ steps.auth.outputs.token }}