-
Notifications
You must be signed in to change notification settings - Fork 74
114 lines (100 loc) · 3.54 KB
/
installer-release.yml
File metadata and controls
114 lines (100 loc) · 3.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
name: Installer Release
on:
release:
types: ['released']
jobs:
setup_deployment:
name: Validate & Setup
runs-on: ubuntu-24.04
outputs:
version_major: ${{ steps.validate.outputs.version_major }}
version: ${{ steps.validate.outputs.version }}
steps:
- name: Validate Release Version
id: validate
run: |
VERSION="${{ github.event.release.tag_name }}"
echo "Validating release: $VERSION"
if [[ "$VERSION" =~ ^v10\.[0-9]+\.[0-9]+ ]]; then
echo "✅ V10 release detected: $VERSION"
echo "version_major=v10" >> $GITHUB_OUTPUT
echo "version=$VERSION" >> $GITHUB_OUTPUT
elif [[ "$VERSION" =~ ^v11\.[0-9]+\.[0-9]+ ]]; then
echo "✅ V11 release detected: $VERSION"
echo "version_major=v11" >> $GITHUB_OUTPUT
echo "version=$VERSION" >> $GITHUB_OUTPUT
else
echo "⏭️ Skipping: Not a v10 or v11 release (got $VERSION)"
fi
build_v10:
name: Build V10 Installer
runs-on: ubuntu-24.04
needs: setup_deployment
if: needs.setup_deployment.outputs.version_major == 'v10'
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ^1.20
id: go
- name: Build
working-directory: ./installer
env:
GOOS: linux
GOARCH: amd64
run: go build -o installer -v .
- name: Upload Release Assets
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
body_path: ./CHANGELOG.md
draft: false
prerelease: false
files: |
./installer/installer
build_v11:
name: Build V11 Installer
runs-on: ubuntu-24.04
needs: setup_deployment
if: needs.setup_deployment.outputs.version_major == 'v11'
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ^1.20
id: go
- name: Configure git for private modules
run: |
git config --global url."https://${{ secrets.API_SECRET }}:x-oauth-basic@github.com/".insteadOf "https://github.com/"
echo "GOPRIVATE=github.com/utmstack" >> $GITHUB_ENV
echo "GONOPROXY=github.com/utmstack" >> $GITHUB_ENV
echo "GONOSUMDB=github.com/utmstack" >> $GITHUB_ENV
- name: Build
working-directory: ./installer
env:
GOOS: linux
GOARCH: amd64
GOPRIVATE: github.com/utmstack
GONOPROXY: github.com/utmstack
GONOSUMDB: github.com/utmstack
run: |
echo "Building V11 Installer for production release"
go build -o installer -v -ldflags "\
-X 'github.com/utmstack/UTMStack/installer/config.DEFAULT_BRANCH=prod' \
-X 'github.com/utmstack/UTMStack/installer/config.INSTALLER_VERSION=${{ needs.setup_deployment.outputs.version }}' \
-X 'github.com/utmstack/UTMStack/installer/config.REPLACE=${{ secrets.CM_ENCRYPT_SALT }}' \
-X 'github.com/utmstack/UTMStack/installer/config.PUBLIC_KEY=${{ secrets.CM_SIGN_PUBLIC_KEY }}'" .
- name: Upload Release Assets
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
body_path: ./CHANGELOG.md
draft: false
files: |
./installer/installer