Skip to content

Commit 953483c

Browse files
5ZYSZ3Kjsamr
authored andcommitted
feat: add releasing CI
1 parent bce275a commit 953483c

File tree

1 file changed

+93
-0
lines changed

1 file changed

+93
-0
lines changed

.github/workflows/release.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
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:core
64+
yarn build:table
65+
yarn build:heuristic-table
66+
yarn build:iframe
67+
68+
- name: Determine bump type
69+
id: bump
70+
run: |
71+
BUMP="${{ inputs.bump }}"
72+
if [ "${{ inputs.prerelease }}" == "true" ]; then
73+
BUMP="pre${{ inputs.bump }} --preid alpha --dist-tag alpha"
74+
fi
75+
if [ "${{ inputs.dryrun }}" == "true" ]; then
76+
BUMP="$BUMP --dry-run"
77+
fi
78+
echo "$BUMP" >> $GITHUB_OUTPUT
79+
80+
- name: Release
81+
run: yarn release ${{ steps.bump.outputs.type }} --yes
82+
env:
83+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
84+
85+
- name: Create pull request
86+
run: |
87+
gh pr create \
88+
--title "chore: release-$(date +%Y-%m-%d_%H:%M:%S)"" \
89+
--body "chore: this PR contains the changes from the release workflow: version bumps, changelog updates, and README synchronization." \
90+
--base main \
91+
--head "$RELEASE_BRANCH"
92+
env:
93+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)