Skip to content

Commit b31fbbb

Browse files
committed
trigger installer action when release is released or prereleased
1 parent e41362b commit b31fbbb

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

.github/workflows/v11-principal-installer-release.yml

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
name: Installer Release V11
22

33
on:
4-
workflow_dispatch:
5-
inputs:
6-
version_tag:
7-
description: "Version to deploy. (e.g., v11.0.0-alpha.1)"
8-
required: true
4+
release:
5+
types: ['released', 'prereleased']
96

107
jobs:
118
setup_deployment:
@@ -18,7 +15,14 @@ jobs:
1815
- name: Validate and Determine Build Environment
1916
id: set-env
2017
run: |
21-
VERSION="${{ github.event.inputs.version_tag }}"
18+
VERSION="${{ github.event.release.tag_name }}"
19+
20+
# Verify tag starts with v11.
21+
if [[ ! "$VERSION" =~ ^v11\. ]]; then
22+
echo "Skipping: This workflow only processes v11.* releases"
23+
echo "Received tag: $VERSION"
24+
exit 0
25+
fi
2226
2327
# Validate version format and determine environment
2428
if [[ "$VERSION" =~ ^v11\.[0-9]+\.[0-9]+$ ]]; then
@@ -48,7 +52,7 @@ jobs:
4852
name: Build
4953
runs-on: ubuntu-24.04
5054
needs: setup_deployment
51-
if: ${{ needs.setup_deployment.outputs.environment != '' }}
55+
if: needs.setup_deployment.outputs.environment != ''
5256
steps:
5357
- name: Check out code into the right branch
5458
uses: actions/checkout@v4
@@ -76,22 +80,18 @@ jobs:
7680
GONOSUMDB: github.com/utmstack
7781
run: |
7882
echo "Building Installer..."
79-
go build -o installer -v -ldflags "\
80-
-X 'github.com/utmstack/UTMStack/installer/config.DEFAULT_BRANCH=${{ needs.setup_deployment.outputs.environment }}' \
81-
-X 'github.com/utmstack/UTMStack/installer/config.INSTALLER_VERSION=${{ needs.setup_deployment.outputs.version }}' \
82-
-X 'github.com/utmstack/UTMStack/installer/config.REPLACE=${{ secrets.CM_ENCRYPT_SALT }}' \
83-
-X 'github.com/utmstack/UTMStack/installer/config.PUBLIC_KEY=${{ secrets.CM_SIGN_PUBLIC_KEY }}'" .
83+
go build -o installer -v -ldflags "\
84+
-X 'github.com/utmstack/UTMStack/installer/config.DEFAULT_BRANCH=${{ needs.setup_deployment.outputs.environment }}' \
85+
-X 'github.com/utmstack/UTMStack/installer/config.INSTALLER_VERSION=${{ needs.setup_deployment.outputs.version }}' \
86+
-X 'github.com/utmstack/UTMStack/installer/config.REPLACE=${{ secrets.CM_ENCRYPT_SALT }}' \
87+
-X 'github.com/utmstack/UTMStack/installer/config.PUBLIC_KEY=${{ secrets.CM_SIGN_PUBLIC_KEY }}'" .
8488
85-
- name: Create Release
86-
id: create_release
89+
- name: Upload Release Assets
8790
uses: softprops/action-gh-release@v2
8891
env:
8992
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9093
with:
91-
tag_name: ${{ needs.setup_deployment.outputs.version }}
92-
name: ${{ needs.setup_deployment.outputs.version }}
9394
body_path: ./CHANGELOG.md
9495
draft: false
95-
prerelease: ${{ needs.setup_deployment.outputs.environment != 'prod' }}
9696
files: |
9797
./installer/installer

0 commit comments

Comments
 (0)