Skip to content

Commit 46e6da0

Browse files
Refactor: update release workflow to use workflow_dispatch and streamline version bump process
1 parent 0f5fe38 commit 46e6da0

2 files changed

Lines changed: 32 additions & 85 deletions

File tree

.github/workflows/bump.yml

Lines changed: 0 additions & 61 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,29 @@
1-
name: Release app
1+
name: Bump and release
22

33
on:
4-
push:
5-
branches:
6-
- main
4+
workflow_dispatch:
5+
inputs:
6+
type:
7+
description: Version bump type
8+
required: true
9+
default: patch
10+
type: choice
11+
options:
12+
- patch
13+
- minor
14+
- major
715

816
jobs:
9-
code-quality:
17+
quality:
1018
uses: ./.github/workflows/code-quality.yml
1119

12-
build:
13-
needs: code-quality
20+
release:
21+
needs: quality
1422
runs-on: windows-latest
23+
permissions:
24+
contents: write
1525
steps:
16-
- name: GitHub checkout
26+
- name: Checkout
1727
uses: actions/checkout@v6
1828

1929
- name: Setup Node.js
@@ -22,32 +32,30 @@ jobs:
2232
node-version: 24
2333
cache: npm
2434

25-
- name: Get version
26-
id: package_version
27-
run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
35+
- name: Configure Git
36+
run: |
37+
git config user.name "github-actions[bot]"
38+
git config user.email "github-actions[bot]@users.noreply.github.com"
2839
shell: bash
2940

30-
- name: Check if tag exists
31-
id: check_tag
41+
- name: Bump version
42+
id: version
3243
run: |
33-
if git ls-remote --tags origin | grep -q "refs/tags/v${{ steps.package_version.outputs.version }}"; then
34-
echo "exists=true" >> $GITHUB_OUTPUT
35-
else
36-
echo "exists=false" >> $GITHUB_OUTPUT
37-
fi
44+
npm version ${{ inputs.type }} --no-git-tag-version
45+
echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
3846
shell: bash
3947

40-
- name: Skip release
41-
if: steps.check_tag.outputs.exists == 'true'
42-
run: echo "::notice::Release v${{ steps.package_version.outputs.version }} already exists, skipping build and publish"
48+
- name: Commit and push
49+
run: |
50+
git add package.json package-lock.json
51+
git commit -m "Bump version to ${{ steps.version.outputs.version }}"
52+
git push origin main
4353
shell: bash
4454

4555
- name: Install dependencies
46-
if: steps.check_tag.outputs.exists == 'false'
4756
run: npm ci
4857

49-
- name: Publish app
50-
if: steps.check_tag.outputs.exists == 'false'
58+
- name: Publish
5159
env:
5260
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5361
run: npm run publish

0 commit comments

Comments
 (0)