Add GitHub release workflow (#14346)

Co-authored-by: Philipp Spiess <hello@philippspiess.com>
This commit is contained in:
Jordan Pittman 2024-09-05 09:45:29 -04:00 • committed by GitHub
parent 27cced0d16
commit aa0075f57f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 61 additions and 13 deletions

View file

@ -2,14 +2,14 @@ name: CI
on:
push:
branches: [master, next]
branches: [next]
pull_request:
permissions:
contents: read
jobs:
build:
tests:
strategy:
fail-fast: false
matrix:

View file

@ -139,7 +139,7 @@ jobs:
path: ${{ env.OXIDE_LOCATION }}/*.node
release:
runs-on: ubuntu-latest
runs-on: macos-14
timeout-minutes: 15
name: Build and release Tailwind CSS
@ -160,7 +160,6 @@ jobs:
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'pnpm'
registry-url: 'https://registry.npmjs.org'
# Cargo already skips downloading dependencies if they already exist
- name: Cache cargo
@ -186,7 +185,7 @@ jobs:
key: ${{ runner.os }}-${{ matrix.target }}-oxide-${{ hashFiles('./crates/**/*') }}
- name: Install dependencies
run: pnpm --filter=!./playgrounds/* install --ignore-scripts
run: pnpm --filter=!./playgrounds/* install
- name: Download artifacts
uses: actions/download-artifact@v4
@ -216,13 +215,35 @@ jobs:
- name: Lock pre-release versions
run: node ./scripts/lock-pre-release-versions.mjs
- name: Publish
run: pnpm --recursive publish --tag ${{ inputs.release_channel }} --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Get release notes
run: |
RELEASE_NOTES=$(node ./scripts/release-notes.mjs)
echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV
echo "$RELEASE_NOTES" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Upload Standalone Artifacts
uses: actions/upload-artifact@v4
with:
name: tailwindcss-standalone
path: packages/@tailwindcss-standalone/dist/
- name: Publish
run: pnpm --recursive publish --tag ${{ inputs.release_channel }} --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Release
uses: softprops/action-gh-release@v2
with:
draft: true
tag_name: ${{ env.TAG_NAME }}
body: |
${{ env.RELEASE_NOTES }}
files: |
packages/@tailwindcss-standalone/dist/sha256sums.txt
packages/@tailwindcss-standalone/dist/tailwindcss-linux-arm64
packages/@tailwindcss-standalone/dist/tailwindcss-linux-x64
packages/@tailwindcss-standalone/dist/tailwindcss-macos-arm64
packages/@tailwindcss-standalone/dist/tailwindcss-macos-x64
packages/@tailwindcss-standalone/dist/tailwindcss-windows-x64.exe

View file

@ -1,6 +1,7 @@
{
"name": "@tailwindcss/standalone",
"version": "4.0.0-alpha.22",
"private": true,
"description": "Standalone CLI for Tailwind CSS",
"license": "MIT",
"repository": {
@ -23,10 +24,6 @@
"files": [
"dist"
],
"publishConfig": {
"provenance": true,
"access": "public"
},
"dependencies": {
"@tailwindcss/cli": "workspace:^",
"detect-libc": "1.0.3",

29
scripts/release-notes.mjs Normal file
View file

@ -0,0 +1,29 @@
// Given a version, figure out what the release notes are so that we can use this to pre-fill the
// relase notes on a GitHub release for the current version.
import * as fs from 'node:fs/promises'
import * as path from 'node:path'
import * as url from 'node:url'
const __dirname = path.dirname(url.fileURLToPath(import.meta.url))
let version = process.argv[2] || process.env.npm_package_version
if (!version) {
let pkgPath = path.resolve(__dirname, '../packages/tailwindcss/package.json')
let pkg = await fs.readFile(pkgPath, 'utf8').then(JSON.parse)
version = pkg.version
}
let changelog = await fs.readFile(path.resolve(__dirname, '..', 'CHANGELOG.md'), 'utf8')
let match = new RegExp(
`## \\[${version}\\] - (.*)\\n\\n([\\s\\S]*?)\\n(?:(?:##\\s)|(?:\\[))`,
'g',
).exec(changelog)
if (match) {
let [, , notes] = match
console.log(notes.trim())
} else {
console.log(`Placeholder release notes for version: v${version}`)
}

View file

@ -30,6 +30,7 @@ const syncedWorkspaces = new Map([
'crates/node/npm/win32-x64-msvc',
],
],
['@tailwindcss/cli', ['packages/@tailwindcss-standalone']],
])
const inverseSyncedWorkspaces = new Map()