-
Notifications
You must be signed in to change notification settings - Fork 27
123 lines (123 loc) · 4.52 KB
/
release.yml
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
119
120
121
122
123
name: 'Build & Publish'
on:
push:
branches:
- '**'
tags-ignore:
- '**'
permissions:
contents: write
jobs:
test:
name: 'Test & Lint'
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ['20.x', '22.x', 'lts/*']
concurrency:
group: test:${{ github.event_name }}:${{ github.ref }}:node-${{ matrix.node-version }}
cancel-in-progress: true
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Enable Corepack
run: corepack enable
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
- name: Install dependencies
run: yarn install --immutable
# Test
- name: 🧪 Test
run: yarn test
# Lint
- name: 📐 Lint
run: yarn lint
build:
name: 'Build'
runs-on: ubuntu-latest
concurrency:
group: build:${{ github.event_name }}:${{ github.ref }}
cancel-in-progress: true
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Enable Corepack
run: corepack enable
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
- name: Install dependencies
run: yarn install --immutable
- name: 📦 Build
run: yarn build
- name: ⬆️ Upload built library
uses: actions/upload-artifact@v4 # upload built files to be used in release job
with:
name: dist
path: dist
retention-days: 1
release:
name: 'Release'
needs: [test, build]
runs-on: ubuntu-latest
permissions:
contents: write
issues: write
pull-requests: write
packages: write
concurrency:
group: release:${{ github.event_name }}:${{ github.ref }}
cancel-in-progress: true
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: Enable Corepack
run: corepack enable
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
- name: Install dependencies
run: yarn install --immutable
- name: ⬇️ Download built library
uses: actions/download-artifact@v4
with:
name: dist
path: dist
- name: 🚀 Semantic Release
id: release
uses: cycjimmy/semantic-release-action@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
DEBUG: ${{ secrets.ACTIONS_STEP_DEBUG == 'true' && 'semantic-release:*' || '' }}
with:
semantic_version: 23.0.8 # semantic-release version, same as in package.json
- name: 📝 Add release notes to build summary
if: steps.release.outputs.new_release_published == 'true'
run: |
NEW_RELEASE_VERSION=${{ steps.release.outputs.new_release_version }}
echo "# New package version published: \`v$NEW_RELEASE_VERSION\`" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
echo "yarn add uno@$NEW_RELEASE_VERSION" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
yarn exec ts-node build/append-to-file.ts $GITHUB_STEP_SUMMARY <<"END_OF_CONTENT"
${{ steps.release.outputs.new_release_notes }}
END_OF_CONTENT
- name: ∅ No new package published
if: steps.release.outputs.new_release_published == 'false'
run: |
echo "# No new version published" >> $GITHUB_STEP_SUMMARY