Repository navigation
84 lines (68 loc) · 2.56 KB
/
Copy pathrelease.yml
File metadata and controls
84 lines (68 loc) · 2.56 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
name: Release
on:
push:
branches:
- main
- develop
- beta
concurrency:
group: release-${{ github.ref_name }}
cancel-in-progress: false
permissions:
contents: write
issues: write
pull-requests: write
id-token: write
jobs:
release:
name: Build, Test & Release
runs-on: ubuntu-latest
outputs:
new_release_published: ${{ steps.semantic.outputs.new_release_published }}
new_release_version: ${{ steps.semantic.outputs.new_release_version }}
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
persist-credentials: false
- uses: pnpm/action-setup@v6
- uses: actions/setup-node@v7
with:
node-version: '22.14.0' # npm trusted publishing requires Node 22.14+
cache: pnpm
registry-url: https://registry.npmjs.org
- name: Upgrade npm for trusted publishing
run: npm install --global npm@^11.5.1
- name: Show tool versions
run: |
node --version
npm --version
pnpm --version
- run: pnpm install --frozen-lockfile
- name: Type check
run: pnpm typecheck
- name: Lint
run: pnpm lint
- name: Test
run: pnpm test
- name: Build
run: pnpm build
- name: Semantic Release
id: semantic
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: pnpm exec semantic-release
- name: Release summary
if: steps.semantic.outputs.new_release_published == 'true'
run: |
echo "## 🚀 Released v${{ steps.semantic.outputs.new_release_version }}" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
echo "- **npm**: [@macpaw/ai-sdk@${{ steps.semantic.outputs.new_release_version }}](https://www.npmjs.com/package/@macpaw/ai-sdk/v/${{ steps.semantic.outputs.new_release_version }})" >> "$GITHUB_STEP_SUMMARY"
echo "- **Tag**: [v${{ steps.semantic.outputs.new_release_version }}](${{ github.server_url }}/${{ github.repository }}/releases/tag/v${{ steps.semantic.outputs.new_release_version }})" >> "$GITHUB_STEP_SUMMARY"
echo "- **Branch**: \`${{ github.ref_name }}\`" >> "$GITHUB_STEP_SUMMARY"
echo "- **Commit**: \`${{ github.sha }}\`" >> "$GITHUB_STEP_SUMMARY"
- name: No release needed
if: steps.semantic.outputs.new_release_published != 'true'
run: |
echo "## ℹ️ No release needed" >> "$GITHUB_STEP_SUMMARY"
echo "No relevant changes detected since last release." >> "$GITHUB_STEP_SUMMARY"