Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GitHub release workflow #14346

Merged
merged 22 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ name: CI

on:
push:
branches: [master, next]
branches: [next]
pull_request:

permissions:
contents: read

jobs:
build:
tests:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I renamed this to test so it's clearer what's going on in the GitHub action list. It's now called "CI / tests" instead of "CI / build" and "Release / build"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah that's a good idea

strategy:
fail-fast: false
matrix:
Expand Down
35 changes: 28 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
4 changes: 2 additions & 2 deletions integrations/cli/config.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { candidate, css, html, js, json, test } from '../utils'
import { candidate, css, html, js, json, test, ts } from '../utils'

test(
'Config files (CJS)',
Expand Down Expand Up @@ -99,7 +99,7 @@ test(
'index.html': html`
<div class="text-primary"></div>
`,
'tailwind.config.ts': js`
'tailwind.config.ts': ts`
export default {
theme: {
extend: {
Expand Down
3 changes: 2 additions & 1 deletion integrations/vite/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
retryAssertion,
test,
ts,
txt,
yaml,
} from '../utils'
;['postcss', 'lightningcss'].forEach((transformer) => {
Expand All @@ -24,7 +25,7 @@ import {
packages:
- project-a
`,
'project-a/package.json': json`
'project-a/package.json': txt`
{
"type": "module",
"dependencies": {
Expand Down
5 changes: 1 addition & 4 deletions packages/@tailwindcss-standalone/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "@tailwindcss/standalone",
"version": "4.0.0-alpha.22",
"private": true,
"description": "Standalone CLI for Tailwind CSS",
"license": "MIT",
"repository": {
Expand All @@ -23,10 +24,6 @@
"files": [
"dist"
],
"publishConfig": {
"provenance": true,
"access": "public"
},
"dependencies": {
"@tailwindcss/cli": "workspace:^",
"detect-libc": "1.0.3",
Expand Down
29 changes: 29 additions & 0 deletions scripts/release-notes.mjs
Original file line number Diff line number Diff line change
@@ -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}`)
}
1 change: 1 addition & 0 deletions scripts/version-packages.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const syncedWorkspaces = new Map([
'crates/node/npm/win32-x64-msvc',
],
],
['@tailwindcss/cli', ['packages/@tailwindcss-standalone']],
])

const inverseSyncedWorkspaces = new Map()
Expand Down