mirror of
https://github.com/tailwindlabs/tailwindcss.git
synced 2025-12-08 21:36:08 +00:00
Prepare for release (#9605)
* rename `build-cli.yml` to `prepare-release.yml` In other repo's we will also have a `prepare-release` so this makes it a bit more consistent. * use common CONSTANT_CASE for environment variables * use `strategy` for defining the node version * add script to get the release notes * add release notes to release draft * use CONSTANT_CASE for environment variables * improve consistency for relase related scripts
This commit is contained in:
parent
ddb9b4d7bc
commit
cb6e45a3bc
@ -1,4 +1,4 @@
|
||||
name: Build Standalone CLI
|
||||
name: Prepare Release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
@ -13,10 +13,16 @@ permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build_cli:
|
||||
build:
|
||||
permissions:
|
||||
contents: write # for softprops/action-gh-release to create GitHub release
|
||||
|
||||
runs-on: macos-11
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [16]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
@ -25,12 +31,19 @@ jobs:
|
||||
- name: Resolve version
|
||||
id: vars
|
||||
run: |
|
||||
echo "tag_name=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
|
||||
echo "TAG_NAME=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
|
||||
|
||||
- name: Use Node.js 16
|
||||
- name: Get release notes
|
||||
run: |
|
||||
RELEASE_NOTES=$(npm run release-notes --silent)
|
||||
echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV
|
||||
echo "$RELEASE_NOTES" >> $GITHUB_ENV
|
||||
echo "EOF" >> $GITHUB_ENV
|
||||
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: '16'
|
||||
node-version: ${{ matrix.node-version }}
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
|
||||
- name: Build tailwindcss
|
||||
@ -52,14 +65,16 @@ jobs:
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
draft: true
|
||||
tag_name: ${{ env.tag_name }}
|
||||
tag_name: ${{ env.TAG_NAME }}
|
||||
body: |
|
||||
* [Linux (arm64)](https://github.com/tailwindlabs/tailwindcss/releases/download/${{ env.tag_name }}/tailwindcss-linux-arm64)
|
||||
* [Linux (armv7)](https://github.com/tailwindlabs/tailwindcss/releases/download/${{ env.tag_name }}/tailwindcss-linux-armv7)
|
||||
* [Linux (x64)](https://github.com/tailwindlabs/tailwindcss/releases/download/${{ env.tag_name }}/tailwindcss-linux-x64)
|
||||
* [macOS (arm64)](https://github.com/tailwindlabs/tailwindcss/releases/download/${{ env.tag_name }}/tailwindcss-macos-arm64)
|
||||
* [macOS (x64)](https://github.com/tailwindlabs/tailwindcss/releases/download/${{ env.tag_name }}/tailwindcss-macos-x64)
|
||||
* [Windows (x64)](https://github.com/tailwindlabs/tailwindcss/releases/download/${{ env.tag_name }}/tailwindcss-windows-x64.exe)
|
||||
${{ env.RELEASE_NOTES }}
|
||||
|
||||
* [Linux (arm64)](https://github.com/tailwindlabs/tailwindcss/releases/download/${{ env.TAG_NAME }}/tailwindcss-linux-arm64)
|
||||
* [Linux (armv7)](https://github.com/tailwindlabs/tailwindcss/releases/download/${{ env.TAG_NAME }}/tailwindcss-linux-armv7)
|
||||
* [Linux (x64)](https://github.com/tailwindlabs/tailwindcss/releases/download/${{ env.TAG_NAME }}/tailwindcss-linux-x64)
|
||||
* [macOS (arm64)](https://github.com/tailwindlabs/tailwindcss/releases/download/${{ env.TAG_NAME }}/tailwindcss-macos-arm64)
|
||||
* [macOS (x64)](https://github.com/tailwindlabs/tailwindcss/releases/download/${{ env.TAG_NAME }}/tailwindcss-macos-x64)
|
||||
* [Windows (x64)](https://github.com/tailwindlabs/tailwindcss/releases/download/${{ env.TAG_NAME }}/tailwindcss-windows-x64.exe)
|
||||
files: |
|
||||
standalone-cli/dist/tailwindcss-linux-arm64
|
||||
standalone-cli/dist/tailwindcss-linux-armv7
|
||||
8
.github/workflows/release-insiders.yml
vendored
8
.github/workflows/release-insiders.yml
vendored
@ -61,10 +61,10 @@ jobs:
|
||||
- name: Resolve version
|
||||
id: vars
|
||||
run: |
|
||||
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
|
||||
echo "SHA_SHORT=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
|
||||
|
||||
- name: 'Version based on commit: 0.0.0-insiders.${{ env.sha_short }}'
|
||||
run: npm version 0.0.0-insiders.${{ env.sha_short }} --force --no-git-tag-version
|
||||
- name: 'Version based on commit: 0.0.0-insiders.${{ env.SHA_SHORT }}'
|
||||
run: npm version 0.0.0-insiders.${{ env.SHA_SHORT }} --force --no-git-tag-version
|
||||
|
||||
- name: Publish
|
||||
run: npm publish --tag insiders
|
||||
@ -83,6 +83,6 @@ jobs:
|
||||
ref: 'master',
|
||||
workflow_id: 'upgrade-tailwindcss.yml',
|
||||
inputs: {
|
||||
insidersVersion: '0.0.0-insiders.${{ env.sha_short }}'
|
||||
insidersVersion: '0.0.0-insiders.${{ env.SHA_SHORT }}'
|
||||
}
|
||||
})
|
||||
|
||||
10
.github/workflows/release.yml
vendored
10
.github/workflows/release.yml
vendored
@ -47,17 +47,17 @@ jobs:
|
||||
|
||||
- name: Calculate environment variables
|
||||
run: |
|
||||
echo "tag_name=$(npm run calculate-tag-name --silent)" >> $GITHUB_ENV
|
||||
echo "tailwindcss_version=$(node -e 'console.log(require(`./package.json`).version);')" >> $GITHUB_ENV
|
||||
echo "RELEASE_CHANNEL=$(npm run release-channel --silent)" >> $GITHUB_ENV
|
||||
echo "TAILWINDCSS_VERSION=$(node -e 'console.log(require(`./package.json`).version);')" >> $GITHUB_ENV
|
||||
|
||||
- name: Publish
|
||||
run: npm publish --tag ${{ env.tag_name }}
|
||||
run: npm publish --tag ${{ env.RELEASE_CHANNEL }}
|
||||
env:
|
||||
CI: true
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
|
||||
- name: Trigger Tailwind Play update
|
||||
if: env.tag_name == 'latest'
|
||||
if: env.RELEASE_CHANNEL == 'latest'
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
github-token: ${{ secrets.TAILWIND_PLAY_TOKEN }}
|
||||
@ -68,6 +68,6 @@ jobs:
|
||||
ref: 'master',
|
||||
workflow_id: 'upgrade-tailwindcss.yml',
|
||||
inputs: {
|
||||
version: '${{ env.tailwindcss_version }}'
|
||||
version: '${{ env.TAILWINDCSS_VERSION }}'
|
||||
}
|
||||
})
|
||||
|
||||
@ -27,7 +27,8 @@
|
||||
"generate:plugin-list": "node -r @swc/register scripts/create-plugin-list.js",
|
||||
"generate:types": "node -r @swc/register scripts/generate-types.js",
|
||||
"generate": "npm run generate:plugin-list && npm run generate:types",
|
||||
"calculate-tag-name": "node scripts/calculate-tag-name.js"
|
||||
"release-channel": "node ./scripts/release-channel.js",
|
||||
"release-notes": "node ./scripts/release-notes.js"
|
||||
},
|
||||
"files": [
|
||||
"src/*",
|
||||
|
||||
@ -1,8 +0,0 @@
|
||||
let version = process.env.npm_package_version || require('../package.json').version
|
||||
|
||||
let match = /\d+\.\d+\.\d+-(.*)\.\d+/g.exec(version)
|
||||
if (match) {
|
||||
console.log(match[1])
|
||||
} else {
|
||||
console.log('latest')
|
||||
}
|
||||
18
scripts/release-channel.js
Normal file
18
scripts/release-channel.js
Normal file
@ -0,0 +1,18 @@
|
||||
// Given a version, figure out what the release channel is so that we can publish to the correct
|
||||
// channel on npm.
|
||||
//
|
||||
// E.g.:
|
||||
//
|
||||
// 1.2.3 -> latest (default)
|
||||
// 0.0.0-insiders.ffaa88 -> insiders
|
||||
// 4.1.0-alpha.4 -> alpha
|
||||
|
||||
let version =
|
||||
process.argv[2] || process.env.npm_package_version || require('../package.json').version
|
||||
|
||||
let match = /\d+\.\d+\.\d+-(.*)\.\d+/g.exec(version)
|
||||
if (match) {
|
||||
console.log(match[1])
|
||||
} else {
|
||||
console.log('latest')
|
||||
}
|
||||
21
scripts/release-notes.js
Normal file
21
scripts/release-notes.js
Normal file
@ -0,0 +1,21 @@
|
||||
// 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.
|
||||
|
||||
let path = require('path')
|
||||
let fs = require('fs')
|
||||
|
||||
let version =
|
||||
process.argv[2] || process.env.npm_package_version || require('../package.json').version
|
||||
|
||||
let changelog = fs.readFileSync(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}`)
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user