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

Prepare for release #9605

Merged
merged 7 commits into from Oct 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -1,4 +1,4 @@
name: Build Standalone CLI
name: Prepare Release

on:
workflow_dispatch:
Expand All @@ -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

Expand All @@ -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
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/release-insiders.yml
Expand Up @@ -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
Expand All @@ -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 changes: 5 additions & 5 deletions .github/workflows/release.yml
Expand Up @@ -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 }}
Expand All @@ -68,6 +68,6 @@ jobs:
ref: 'master',
workflow_id: 'upgrade-tailwindcss.yml',
inputs: {
version: '${{ env.tailwindcss_version }}'
version: '${{ env.TAILWINDCSS_VERSION }}'
}
})
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -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/*",
Expand Down
8 changes: 0 additions & 8 deletions scripts/calculate-tag-name.js

This file was deleted.

18 changes: 18 additions & 0 deletions scripts/release-channel.js
@@ -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 changes: 21 additions & 0 deletions scripts/release-notes.js
@@ -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}`)
}