Skip to content

Commit 515a9bd

Browse files
authored
Setup v4 releases (#15961)
Now that Tailwind CSS v4 is released, we can setup a proper release workflow again. This setup mimics the workflow of how we did it in v3, but adjusted to make it work on the v4 codebase. Whenever a PR is merged into the `next` branch, we will publish an insiders release to npm using the following version number: `0.0.0-insiders.<commit-hash>`. Note: insiders releases will not have a GitHub release associated with them, therefore the `standalone-cli` won't be available as an insiders release. For the normal release procedure, the following steps are required: 1. Manually version the packages (e.g.: `pnpm run version-packages`) 2. Create a git tag for the version you want to release 3. Push the updated package.json files and the git tag to the repository Next, a GitHub action will kick in once a `tag` is being pushed. The GitHub action will run a build, and create a draft release on GitHub that will contain: 1. The CHANGELOG.md contents for the last version 2. The `standalone-cli` artifacts attached to the drafted release Once you are happy with the draft, you can publish the draft on GitHub. This in turn will trigger another GitHub action that will publish the packages to npm. Whenever an insiders release or a normal release completes, we will also trigger Tailwind Play, to update its dependencies to the latest version of Tailwind CSS. --- Note: some of the GitHub Action workflows still refer to the `next` branch instead of the `main` branch. If we later today want to get a new release out, we can merge `next` into `main` and update the workflows accordingly. --- This is hard to test, but I started from the existing release.yml file and adjusted things accordingly. The biggest change is related to the insiders version. If you look at this temporary [commit](572dddf), you can see that the publishing (dry-run) seems to work as expected: <img width="1508" alt="image" src="https://github.com/user-attachments/assets/c075e788-dcbc-4200-aa32-2b9a3c54d629" />
1 parent 2c1dea4 commit 515a9bd

File tree

5 files changed

+560
-53
lines changed

5 files changed

+560
-53
lines changed

.github/workflows/prepare-release.yml

Lines changed: 242 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,257 @@ name: Prepare Release
22

33
on:
44
workflow_dispatch:
5+
push:
6+
tags:
7+
- 'v*'
58

69
env:
7-
CI: true
10+
APP_NAME: tailwindcss-oxide
11+
NODE_VERSION: 20
12+
OXIDE_LOCATION: ./crates/node
813

914
permissions:
1015
contents: read
1116

1217
jobs:
1318
build:
14-
runs-on: macos-12
15-
timeout-minutes: 15
16-
1719
strategy:
1820
matrix:
19-
node-version: [16]
21+
include:
22+
# Windows
23+
- os: windows-latest
24+
target: x86_64-pc-windows-msvc
25+
- os: windows-latest
26+
target: aarch64-pc-windows-msvc
27+
# macOS
28+
- os: macos-latest
29+
target: x86_64-apple-darwin
30+
strip: strip -x # Must use -x on macOS. This produces larger results on linux.
31+
- os: macos-latest
32+
target: aarch64-apple-darwin
33+
page-size: 14
34+
strip: strip -x # Must use -x on macOS. This produces larger results on linux.
35+
# Android
36+
- os: ubuntu-latest
37+
target: aarch64-linux-android
38+
strip: ${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip
39+
- os: ubuntu-latest
40+
target: armv7-linux-androideabi
41+
strip: ${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip
42+
# Linux
43+
- os: ubuntu-latest
44+
target: x86_64-unknown-linux-gnu
45+
strip: strip
46+
container:
47+
image: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian
48+
- os: ubuntu-latest
49+
target: aarch64-unknown-linux-gnu
50+
strip: llvm-strip
51+
container:
52+
image: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian-aarch64
53+
- os: ubuntu-latest
54+
target: armv7-unknown-linux-gnueabihf
55+
strip: llvm-strip
56+
container:
57+
image: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian-zig
58+
- os: ubuntu-latest
59+
target: aarch64-unknown-linux-musl
60+
strip: aarch64-linux-musl-strip
61+
download: true
62+
container:
63+
image: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
64+
- os: ubuntu-latest
65+
target: x86_64-unknown-linux-musl
66+
strip: strip
67+
download: true
68+
container:
69+
image: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
70+
71+
name: Build ${{ matrix.target }} (OXIDE)
72+
runs-on: ${{ matrix.os }}
73+
container: ${{ matrix.container }}
74+
timeout-minutes: 15
75+
steps:
76+
- uses: actions/checkout@v4
77+
- uses: pnpm/action-setup@v4
78+
79+
- name: Use Node.js ${{ env.NODE_VERSION }}
80+
uses: actions/setup-node@v4
81+
with:
82+
node-version: ${{ env.NODE_VERSION }}
83+
cache: 'pnpm'
84+
85+
# Cargo already skips downloading dependencies if they already exist
86+
- name: Cache cargo
87+
uses: actions/cache@v4
88+
with:
89+
path: |
90+
~/.cargo/bin/
91+
~/.cargo/registry/index/
92+
~/.cargo/registry/cache/
93+
~/.cargo/git/db/
94+
target/
95+
key: ${{ runner.os }}-${{ matrix.target }}-cargo-${{ hashFiles('**/Cargo.lock') }}
96+
97+
# Cache the `oxide` Rust build
98+
- name: Cache oxide build
99+
uses: actions/cache@v4
100+
with:
101+
path: |
102+
./oxide/target/
103+
./crates/node/*.node
104+
./crates/node/index.js
105+
./crates/node/index.d.ts
106+
key: ${{ runner.os }}-${{ matrix.target }}-oxide-${{ hashFiles('./crates/**/*') }}
107+
108+
- name: Install Node.JS
109+
uses: actions/setup-node@v4
110+
with:
111+
node-version: ${{ env.NODE_VERSION }}
112+
113+
- name: Install Rust (Stable)
114+
if: ${{ matrix.download }}
115+
run: |
116+
rustup default stable
117+
118+
- name: Setup rust target
119+
run: rustup target add ${{ matrix.target }}
120+
121+
- name: Install dependencies
122+
run: pnpm install --ignore-scripts --filter=!./playgrounds/*
123+
124+
- name: Build release
125+
run: pnpm run --filter ${{ env.OXIDE_LOCATION }} build
126+
env:
127+
RUST_TARGET: ${{ matrix.target }}
128+
JEMALLOC_SYS_WITH_LG_PAGE: ${{ matrix.page-size }}
129+
130+
- name: Strip debug symbols # https://github.com/rust-lang/rust/issues/46034
131+
if: ${{ matrix.strip }}
132+
run: ${{ matrix.strip }} ${{ env.OXIDE_LOCATION }}/*.node
133+
134+
- name: Upload artifacts
135+
uses: actions/upload-artifact@v4
136+
with:
137+
name: bindings-${{ matrix.target }}
138+
path: ${{ env.OXIDE_LOCATION }}/*.node
139+
140+
prepare:
141+
runs-on: macos-14
142+
timeout-minutes: 15
143+
name: Build and release Tailwind CSS
144+
145+
permissions:
146+
contents: write # for softprops/action-gh-release to create GitHub release
147+
# https://docs.npmjs.com/generating-provenance-statements#publishing-packages-with-provenance-via-github-actions
148+
id-token: write
149+
150+
needs:
151+
- build
20152

21153
steps:
22-
- run: echo "stub"
154+
- uses: actions/checkout@v4
155+
with:
156+
fetch-tags: true
157+
fetch-depth: 20
158+
159+
- run: git fetch --tags -f
160+
161+
- name: Resolve version
162+
id: vars
163+
run: |
164+
echo "TAG_NAME=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
165+
166+
- uses: pnpm/action-setup@v4
167+
168+
- name: Use Node.js ${{ env.NODE_VERSION }}
169+
uses: actions/setup-node@v4
170+
with:
171+
node-version: ${{ env.NODE_VERSION }}
172+
cache: 'pnpm'
173+
registry-url: 'https://registry.npmjs.org'
174+
175+
# Cargo already skips downloading dependencies if they already exist
176+
- name: Cache cargo
177+
uses: actions/cache@v4
178+
with:
179+
path: |
180+
~/.cargo/bin/
181+
~/.cargo/registry/index/
182+
~/.cargo/registry/cache/
183+
~/.cargo/git/db/
184+
target/
185+
key: ${{ runner.os }}-${{ matrix.target }}-cargo-${{ hashFiles('**/Cargo.lock') }}
186+
187+
# Cache the `oxide` Rust build
188+
- name: Cache oxide build
189+
uses: actions/cache@v4
190+
with:
191+
path: |
192+
./oxide/target/
193+
./crates/node/*.node
194+
./crates/node/index.js
195+
./crates/node/index.d.ts
196+
key: ${{ runner.os }}-${{ matrix.target }}-oxide-${{ hashFiles('./crates/**/*') }}
197+
198+
- name: Install dependencies
199+
run: pnpm --filter=!./playgrounds/* install
200+
201+
- name: Download artifacts
202+
uses: actions/download-artifact@v4
203+
with:
204+
path: ${{ env.OXIDE_LOCATION }}
205+
206+
- name: Move artifacts
207+
run: |
208+
cd ${{ env.OXIDE_LOCATION }}
209+
cp bindings-x86_64-pc-windows-msvc/* ./npm/win32-x64-msvc/
210+
cp bindings-aarch64-pc-windows-msvc/* ./npm/win32-arm64-msvc/
211+
cp bindings-x86_64-apple-darwin/* ./npm/darwin-x64/
212+
cp bindings-aarch64-apple-darwin/* ./npm/darwin-arm64/
213+
cp bindings-aarch64-linux-android/* ./npm/android-arm64/
214+
cp bindings-armv7-linux-androideabi/* ./npm/android-arm-eabi/
215+
cp bindings-aarch64-unknown-linux-gnu/* ./npm/linux-arm64-gnu/
216+
cp bindings-aarch64-unknown-linux-musl/* ./npm/linux-arm64-musl/
217+
cp bindings-armv7-unknown-linux-gnueabihf/* ./npm/linux-arm-gnueabihf/
218+
cp bindings-x86_64-unknown-linux-gnu/* ./npm/linux-x64-gnu/
219+
cp bindings-x86_64-unknown-linux-musl/* ./npm/linux-x64-musl/
220+
221+
- name: Build Tailwind CSS
222+
run: pnpm run build
223+
224+
- name: Run pre-publish optimizations scripts
225+
run: node ./scripts/pre-publish-optimizations.mjs
226+
227+
- name: Lock pre-release versions
228+
run: node ./scripts/lock-pre-release-versions.mjs
229+
230+
- name: Get release notes
231+
run: |
232+
RELEASE_NOTES=$(node ./scripts/release-notes.mjs)
233+
echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV
234+
echo "$RELEASE_NOTES" >> $GITHUB_ENV
235+
echo "EOF" >> $GITHUB_ENV
236+
237+
- name: Upload Standalone Artifacts
238+
uses: actions/upload-artifact@v4
239+
with:
240+
name: tailwindcss-standalone
241+
path: packages/@tailwindcss-standalone/dist/
242+
243+
- name: Prepare GitHub Release
244+
uses: softprops/action-gh-release@v2
245+
with:
246+
draft: true
247+
tag_name: ${{ env.TAG_NAME }}
248+
body: |
249+
${{ env.RELEASE_NOTES }}
250+
files: |
251+
packages/@tailwindcss-standalone/dist/sha256sums.txt
252+
packages/@tailwindcss-standalone/dist/tailwindcss-linux-arm64
253+
packages/@tailwindcss-standalone/dist/tailwindcss-linux-arm64-musl
254+
packages/@tailwindcss-standalone/dist/tailwindcss-linux-x64
255+
packages/@tailwindcss-standalone/dist/tailwindcss-linux-x64-musl
256+
packages/@tailwindcss-standalone/dist/tailwindcss-macos-arm64
257+
packages/@tailwindcss-standalone/dist/tailwindcss-macos-x64
258+
packages/@tailwindcss-standalone/dist/tailwindcss-windows-x64.exe

0 commit comments

Comments
 (0)