Skip to content

Commit 8f0a955

Browse files
committed
chore: add CI release workflow
1 parent acd9f87 commit 8f0a955

File tree

1 file changed

+95
-0
lines changed

1 file changed

+95
-0
lines changed

.github/workflows/release.yml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
bump:
7+
description: 'Version bump type'
8+
required: true
9+
type: choice
10+
options:
11+
- patch
12+
- minor
13+
- major
14+
default: patch
15+
prerelease:
16+
description: 'Pre-release'
17+
required: false
18+
type: boolean
19+
default: false
20+
dryrun:
21+
description: 'Dry-run'
22+
required: false
23+
type: boolean
24+
default: false
25+
26+
jobs:
27+
release:
28+
name: Release
29+
runs-on: ubuntu-latest
30+
31+
permissions:
32+
contents: write
33+
pull-requests: write
34+
35+
steps:
36+
- uses: actions/checkout@v4
37+
with:
38+
fetch-depth: 0
39+
token: ${{ secrets.GITHUB_TOKEN }}
40+
41+
- name: Use Node.js 22.x
42+
uses: actions/setup-node@v4
43+
with:
44+
node-version: '22.x'
45+
registry-url: 'https://registry.npmjs.org'
46+
47+
- name: Configure git
48+
run: |
49+
git config user.name "github-actions[bot]"
50+
git config user.email "github-actions[bot]@users.noreply.github.com"
51+
52+
- name: Create release branch
53+
run: |
54+
BRANCH="chore/release-$(date +%Y-%m-%d_%H:%M:%S)""
55+
echo "RELEASE_BRANCH=$BRANCH" >> $GITHUB_ENV
56+
git checkout -b "$BRANCH"
57+
58+
- name: Install dependencies
59+
run: yarn install --immutable
60+
61+
- name: Build dependencies
62+
run: |
63+
yarn build:css-processor
64+
yarn build:transient-render-engine
65+
yarn build:render
66+
67+
- name: Copy README to packages/render
68+
run: cp README.md packages/render/README.md
69+
70+
- name: Determine bump type
71+
id: bump
72+
run: |
73+
BUMP="${{ inputs.bump }}"
74+
if [ "${{ inputs.prerelease }}" == "true" ]; then
75+
BUMP="pre${{ inputs.bump }} --preid alpha --dist-tag alpha"
76+
fi
77+
if [ "${{ inputs.dryrun }}" == "true" ]; then
78+
BUMP="$BUMP --dry-run"
79+
fi
80+
echo "$BUMP" >> $GITHUB_OUTPUT
81+
82+
- name: Release
83+
run: yarn release ${{ steps.bump.outputs.type }} --yes
84+
env:
85+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
86+
87+
- name: Create pull request
88+
run: |
89+
gh pr create \
90+
--title "chore: release-$(date +%Y-%m-%d_%H:%M:%S)"" \
91+
--body "chore: this PR contains the changes from the release workflow: version bumps, changelog updates, and README synchronization." \
92+
--base main \
93+
--head "$RELEASE_BRANCH"
94+
env:
95+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)