-
Notifications
You must be signed in to change notification settings - Fork 0
109 lines (96 loc) · 3.59 KB
/
release.yml
File metadata and controls
109 lines (96 loc) · 3.59 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
name: Release
on:
push:
tags:
- 'v*.*.*'
permissions:
contents: write
jobs:
release:
name: Validate And Draft Release
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Derive release channel
id: convert_version
run: |
set -euo pipefail
version="${GITHUB_REF_NAME#v}"
channel="stable"
if [[ "$version" == *-* ]]; then
channel="preview"
fi
echo "VERSION=$version" >> "$GITHUB_OUTPUT"
echo "CHANNEL=$channel" >> "$GITHUB_OUTPUT"
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: backend/go.mod
cache-dependency-path: backend/go.sum
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Validate version metadata
run: node .github/scripts/validate-version.mjs "${GITHUB_REF_NAME}"
- name: Generate changelog
uses: orhun/git-cliff-action@v4
with:
config: .github/git-cliff.toml
args: --tag "${{ github.ref_name }}" --output CHANGELOG.md
env:
OUTPUT: CHANGELOG.md
GITHUB_REPO: ${{ github.repository }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build release notes
run: node .github/scripts/build-release-notes.mjs "${GITHUB_REF_NAME}"
- name: Build appos-agent artifact
run: |
set -euo pipefail
mkdir -p artifacts/agent
cd backend
for arch in amd64 arm64; do
output="../artifacts/agent/appos-agent-linux-${arch}"
CGO_ENABLED=0 GOOS=linux GOARCH="${arch}" \
go build -ldflags="-w -s -X main.version=${{ steps.convert_version.outputs.VERSION }}" \
-o "${output}" ./cmd/appos-agent
chmod +x "${output}"
done
cp ../artifacts/agent/appos-agent-linux-amd64 ../artifacts/agent/appos-agent
chmod +x ../artifacts/agent/appos-agent
- name: Generate appos-agent installer
run: |
set -euo pipefail
installer_base_url="https://artifact.websoft9.com/${{ steps.convert_version.outputs.CHANNEL }}/appos/agent"
sed \
-e "s|__APPOS_AGENT_BINARY_URL_AMD64__|${installer_base_url}/appos-agent-linux-amd64|g" \
-e "s|__APPOS_AGENT_BINARY_URL_ARM64__|${installer_base_url}/appos-agent-linux-arm64|g" \
backend/domain/software/scripts/appos-agent-install.sh > artifacts/agent/appos-agent-install.sh
chmod +x artifacts/agent/appos-agent-install.sh
- name: Upload release review artifacts
uses: actions/upload-artifact@v4
with:
name: release-review-${{ github.ref_name }}
path: |
CHANGELOG.md
release-notes.md
docs/version-compatibility-matrix.md
artifacts/agent/appos-agent-linux-amd64
artifacts/agent/appos-agent-linux-arm64
artifacts/agent/appos-agent-install.sh
if-no-files-found: error
- name: Upload release assets
uses: softprops/action-gh-release@v2
with:
draft: true
prerelease: ${{ steps.convert_version.outputs.CHANNEL == 'preview' }}
body_path: release-notes.md
files: |
CHANGELOG.md
docs/version-compatibility-matrix.md
artifacts/agent/appos-agent-linux-amd64
artifacts/agent/appos-agent-linux-arm64
artifacts/agent/appos-agent-install.sh