Skip to content

Commit

Permalink
ci: add new release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Feb 20, 2025
1 parent c4ee71a commit c1feee9
Show file tree
Hide file tree
Showing 10 changed files with 906 additions and 821 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/autofix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- run: npm i -g --force corepack && corepack enable
- uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0
with:
node-version: 22
node-version: lts/*
cache: "pnpm"

- name: Install dependencies
Expand Down
15 changes: 8 additions & 7 deletions .github/workflows/changelogensets.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: changelog
name: release

on:
push:
Expand All @@ -14,8 +14,8 @@ concurrency:
cancel-in-progress: ${{ github.event_name != 'push' }}

jobs:
update:
if: github.repository_owner == 'nuxt' && !contains(github.event.head_commit.message, 'v3.')
update-changelog:
if: github.repository_owner == 'nuxt' && !startsWith(github.event.head_commit.message, 'v')
runs-on: ubuntu-latest

steps:
Expand All @@ -25,12 +25,13 @@ jobs:
- run: npm i -g --force corepack && corepack enable
- uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0
with:
node-version: 22
cache: "pnpm"
node-version: lts/*
cache: pnpm

- name: Install dependencies
- name: 📦 Install dependencies
run: pnpm install

- run: pnpm jiti ./scripts/update-changelog.ts
- name: 🚧 Update changelog
run: node --experimental-strip-types ./scripts/update-changelog.ts
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- run: npm i -g --force corepack && corepack enable
- uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0
with:
node-version: 22
node-version: lts/*
cache: "pnpm"

- name: Install dependencies
Expand All @@ -57,7 +57,7 @@ jobs:
- run: npm i -g --force corepack && corepack enable
- uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0
with:
node-version: 22
node-version: lts/*
cache: "pnpm"

- name: Install dependencies
Expand Down
14 changes: 11 additions & 3 deletions .github/workflows/release-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
push:
branches:
- main
pull_request:
branches:
- main

# Remove default permissions of GITHUB_TOKEN for security
# https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs
Expand All @@ -12,15 +15,15 @@ permissions: {}
jobs:
nightly:
runs-on: ubuntu-latest
if: ${{ github.repository_owner == 'nuxt' && github.event_name == 'push' }}
if: ${{ github.repository_owner == 'nuxt' }}
permissions:
id-token: write
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- run: npm i -g --force corepack && corepack enable
- uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0
with:
node-version: 22
node-version: lts/*
registry-url: "https://registry.npmjs.org/"
cache: "pnpm"

Expand All @@ -30,7 +33,12 @@ jobs:
- name: Prepare build environment
run: pnpm dev:prepare

- name: nightly release
- name: 📦 release pkg.pr.new
if: github.event_name != 'push'
run: pnpm pkg-pr-new publish --compact

- name: 📦 release nightly
if: github.event_name == 'push'
run: pnpm changelogen --canary nightly --publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
Expand Down
38 changes: 28 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
name: release

on:
push:
tags:
- "v*"
pull_request_target:
types: [closed]
branches:
- main

# Remove default permissions of GITHUB_TOKEN for security
# https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs
permissions: {}

jobs:
release:
if: github.repository_owner == 'nuxt'
if: github.repository_owner == 'nuxt' && github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'v')
concurrency:
group: release
permissions:
contents: write
id-token: write
runs-on: ubuntu-latest
timeout-minutes: 20
Expand All @@ -23,18 +27,32 @@ jobs:
- run: npm i -g --force corepack && corepack enable
- uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0
with:
node-version: 22
registry-url: "https://registry.npmjs.org/"
cache: "pnpm"
node-version: lts/*
registry-url: 'https://registry.npmjs.org/'
cache: pnpm

- name: Install dependencies
- name: 📦 Install dependencies
run: pnpm install

- name: Prepare build environment
- name: 🛠 Prepare build environment
run: pnpm dev:prepare

- name: Release
- name: 📦 Release
run: pnpm changelogen --publish
env:
NODE_AUTH_TOKEN: ${{ secrets.RELEASE_NODE_AUTH_TOKEN }}
NPM_CONFIG_PROVENANCE: true

- name: 🏷️ Create tag
run: |
TAG_NAME=${{ github.event.pull_request.head.ref }}
git tag $TAG_NAME
git push origin $TAG_NAME
- name: 🛳️ Create GitHub release
run: gh release create $TAG_NAME --title "$RELEASE_NAME" --notes "$BODY"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG_NAME: ${{ github.event.pull_request.head.ref }}
RELEASE_NAME: ${{ github.event.pull_request.head.ref }}
BODY: ${{ github.event.pull_request.body }}
Loading

0 comments on commit c1feee9

Please sign in to comment.