Skip to content

Commit 482ae6c

Browse files
authored
Fixed release generator (#11)
1 parent 9649456 commit 482ae6c

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

.github/workflows/build-release.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@ name: Build jb_updater
33
on:
44
push:
55
branches: [ "**" ]
6+
tags: [ "v*.*.*" ]
7+
pull_request:
68
workflow_dispatch: { }
79

810
permissions:
911
contents: write
1012

1113
# =========================================================
12-
# =============== BUILD JOBS =========================
14+
# =============== BUILD JOBS ==========================
1315
# =========================================================
1416

1517
jobs:
@@ -110,21 +112,21 @@ jobs:
110112
path: jb_updater-windows-x64.zip
111113

112114
# =========================================================
113-
# =============== MANUAL RELEASE =======================
115+
# =============== RELEASE JOB =========================
114116
# =========================================================
115117

116118
release:
117119
name: Create GitHub Release
118120
needs: [ linux, macos, windows ]
119121
runs-on: ubuntu-latest
120-
if: github.event_name == 'workflow_dispatch'
122+
if: github.event_name == 'workflow_dispatch' || startsWith(github.ref, 'refs/tags/')
121123
steps:
122-
- name: Check branch (only master allowed)
124+
- name: Verify branch or tag
123125
run: |
124-
echo "Triggered for ref: $GITHUB_REF"
125-
if [[ "$GITHUB_REF" != "refs/heads/master" ]]; then
126-
echo "Releases are only allowed from master branch."
127-
exit 0
126+
echo "Triggered by $GITHUB_EVENT_NAME for ref $GITHUB_REF"
127+
if [[ "$GITHUB_EVENT_NAME" == "workflow_dispatch" && "$GITHUB_REF_NAME" != "master" ]]; then
128+
echo "⚠️ Manual releases are allowed only from master branch."
129+
exit 1
128130
fi
129131
- name: Download all build artifacts
130132
uses: actions/download-artifact@v4
@@ -134,7 +136,7 @@ jobs:
134136
run: |
135137
mkdir -p release-assets
136138
find ./all-artifacts -type f -exec mv {} ./release-assets/ \;
137-
- name: Create Release
139+
- name: Create GitHub Release
138140
uses: softprops/action-gh-release@v2
139141
with:
140142
files: release-assets/*

0 commit comments

Comments
 (0)