Skip to content

Commit

Permalink
Add CI pipeline for releases and clean up the workflows (#164)
Browse files Browse the repository at this point in the history
  • Loading branch information
philipp-spiess committed Aug 28, 2024
1 parent 4c0d791 commit c0c7944
Show file tree
Hide file tree
Showing 4 changed files with 104 additions and 18 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Prepare Release

on:
workflow_dispatch:
push:
tags:
- 'v*'

permissions:
contents: read

jobs:
prepare:
permissions:
contents: write # for softprops/action-gh-release to create GitHub release

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [22]

steps:
- uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
registry-url: 'https://registry.npmjs.org'
cache: 'npm'

- name: Install dependencies
run: npm install

- name: Test
run: npm test

- name: Resolve version
id: vars
run: |
echo "TAG_NAME=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
- 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: Release
uses: softprops/action-gh-release@v1
with:
draft: true
tag_name: ${{ env.TAG_NAME }}
body: ${{ env.RELEASE_NOTES }}
22 changes: 5 additions & 17 deletions .github/workflows/release-insiders.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Release Insiders

on:
push:
branches: [master]
branches: [main]

permissions:
contents: read
Expand All @@ -14,31 +14,20 @@ jobs:

strategy:
matrix:
node-version: [12]
node-version: [22]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
registry-url: 'https://registry.npmjs.org'

- name: Use cached node_modules
id: cache
uses: actions/cache@v2
with:
path: node_modules
key: nodeModules-${{ hashFiles('**/package-lock.json') }}-${{ matrix.node-version }}
restore-keys: |
nodeModules-
cache: 'npm'

- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: npm install
env:
CI: true

- name: Resolve version
id: vars
Expand All @@ -50,5 +39,4 @@ jobs:
- name: Publish
run: npm publish --provenance --tag insiders
env:
CI: true
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
42 changes: 42 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Release

on:
release:
types: [published]

permissions:
contents: read
id-token: write

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [22]

steps:
- uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
registry-url: 'https://registry.npmjs.org'
cache: 'npm'

- name: Install dependencies
run: npm install

- name: Test
run: npm test

- name: Calculate environment variables
run: |
echo "RELEASE_CHANNEL=$(npm run release-channel --silent)" >> $GITHUB_ENV
- name: Publish
run: npm publish --provenance --tag ${{ env.RELEASE_CHANNEL }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

- Update `tailwindcss` peer dependency to include `4.0.0-alpha.20` which adds support for this plugin ([#163](https://github.com/tailwindlabs/tailwindcss-forms/pull/163))
- Support installing with alpha versions of Tailwind CSS v4 ([#163](https://github.com/tailwindlabs/tailwindcss-forms/pull/163))

## [0.5.7] - 2023-11-10

Expand Down

0 comments on commit c0c7944

Please sign in to comment.