Skip to content

Commit aa0075f

Browse files
Add GitHub release workflow (#14346)
Co-authored-by: Philipp Spiess <[email protected]>
1 parent 27cced0 commit aa0075f

File tree

5 files changed

+61
-13
lines changed

5 files changed

+61
-13
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ name: CI
22

33
on:
44
push:
5-
branches: [master, next]
5+
branches: [next]
66
pull_request:
77

88
permissions:
99
contents: read
1010

1111
jobs:
12-
build:
12+
tests:
1313
strategy:
1414
fail-fast: false
1515
matrix:

.github/workflows/release.yml

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ jobs:
139139
path: ${{ env.OXIDE_LOCATION }}/*.node
140140

141141
release:
142-
runs-on: ubuntu-latest
142+
runs-on: macos-14
143143
timeout-minutes: 15
144144
name: Build and release Tailwind CSS
145145

@@ -160,7 +160,6 @@ jobs:
160160
with:
161161
node-version: ${{ env.NODE_VERSION }}
162162
cache: 'pnpm'
163-
registry-url: 'https://registry.npmjs.org'
164163

165164
# Cargo already skips downloading dependencies if they already exist
166165
- name: Cache cargo
@@ -186,7 +185,7 @@ jobs:
186185
key: ${{ runner.os }}-${{ matrix.target }}-oxide-${{ hashFiles('./crates/**/*') }}
187186

188187
- name: Install dependencies
189-
run: pnpm --filter=!./playgrounds/* install --ignore-scripts
188+
run: pnpm --filter=!./playgrounds/* install
190189

191190
- name: Download artifacts
192191
uses: actions/download-artifact@v4
@@ -216,13 +215,35 @@ jobs:
216215
- name: Lock pre-release versions
217216
run: node ./scripts/lock-pre-release-versions.mjs
218217

219-
- name: Publish
220-
run: pnpm --recursive publish --tag ${{ inputs.release_channel }} --no-git-checks
221-
env:
222-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
218+
- name: Get release notes
219+
run: |
220+
RELEASE_NOTES=$(node ./scripts/release-notes.mjs)
221+
echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV
222+
echo "$RELEASE_NOTES" >> $GITHUB_ENV
223+
echo "EOF" >> $GITHUB_ENV
223224
224225
- name: Upload Standalone Artifacts
225226
uses: actions/upload-artifact@v4
226227
with:
227228
name: tailwindcss-standalone
228229
path: packages/@tailwindcss-standalone/dist/
230+
231+
- name: Publish
232+
run: pnpm --recursive publish --tag ${{ inputs.release_channel }} --no-git-checks
233+
env:
234+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
235+
236+
- name: Release
237+
uses: softprops/action-gh-release@v2
238+
with:
239+
draft: true
240+
tag_name: ${{ env.TAG_NAME }}
241+
body: |
242+
${{ env.RELEASE_NOTES }}
243+
files: |
244+
packages/@tailwindcss-standalone/dist/sha256sums.txt
245+
packages/@tailwindcss-standalone/dist/tailwindcss-linux-arm64
246+
packages/@tailwindcss-standalone/dist/tailwindcss-linux-x64
247+
packages/@tailwindcss-standalone/dist/tailwindcss-macos-arm64
248+
packages/@tailwindcss-standalone/dist/tailwindcss-macos-x64
249+
packages/@tailwindcss-standalone/dist/tailwindcss-windows-x64.exe

packages/@tailwindcss-standalone/package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"name": "@tailwindcss/standalone",
33
"version": "4.0.0-alpha.22",
4+
"private": true,
45
"description": "Standalone CLI for Tailwind CSS",
56
"license": "MIT",
67
"repository": {
@@ -23,10 +24,6 @@
2324
"files": [
2425
"dist"
2526
],
26-
"publishConfig": {
27-
"provenance": true,
28-
"access": "public"
29-
},
3027
"dependencies": {
3128
"@tailwindcss/cli": "workspace:^",
3229
"detect-libc": "1.0.3",

scripts/release-notes.mjs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Given a version, figure out what the release notes are so that we can use this to pre-fill the
2+
// relase notes on a GitHub release for the current version.
3+
4+
import * as fs from 'node:fs/promises'
5+
import * as path from 'node:path'
6+
import * as url from 'node:url'
7+
8+
const __dirname = path.dirname(url.fileURLToPath(import.meta.url))
9+
10+
let version = process.argv[2] || process.env.npm_package_version
11+
if (!version) {
12+
let pkgPath = path.resolve(__dirname, '../packages/tailwindcss/package.json')
13+
let pkg = await fs.readFile(pkgPath, 'utf8').then(JSON.parse)
14+
15+
version = pkg.version
16+
}
17+
18+
let changelog = await fs.readFile(path.resolve(__dirname, '..', 'CHANGELOG.md'), 'utf8')
19+
let match = new RegExp(
20+
`## \\[${version}\\] - (.*)\\n\\n([\\s\\S]*?)\\n(?:(?:##\\s)|(?:\\[))`,
21+
'g',
22+
).exec(changelog)
23+
24+
if (match) {
25+
let [, , notes] = match
26+
console.log(notes.trim())
27+
} else {
28+
console.log(`Placeholder release notes for version: v${version}`)
29+
}

scripts/version-packages.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ const syncedWorkspaces = new Map([
3030
'crates/node/npm/win32-x64-msvc',
3131
],
3232
],
33+
['@tailwindcss/cli', ['packages/@tailwindcss-standalone']],
3334
])
3435

3536
const inverseSyncedWorkspaces = new Map()

0 commit comments

Comments
 (0)