-
Notifications
You must be signed in to change notification settings - Fork 0
114 lines (94 loc) · 2.93 KB
/
Copy pathbuild-release.yml
File metadata and controls
114 lines (94 loc) · 2.93 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: Build and Release
on:
push:
tags:
- 'v*'
jobs:
build:
name: Build ${{ matrix.os }}-${{ matrix.arch }}
runs-on: ${{ matrix.runs-on }}
strategy:
matrix:
include:
- os: windows
arch: amd64
runs-on: windows-latest
output: testops-mcp-windows-amd64.exe
- os: windows
arch: arm64
runs-on: windows-latest
output: testops-mcp-windows-arm64.exe
- os: darwin
arch: amd64
runs-on: macos-latest
output: testops-mcp-macos-amd64
- os: darwin
arch: arm64
runs-on: macos-latest
output: testops-mcp-macos-arm64
- os: linux
arch: amd64
runs-on: ubuntu-latest
output: testops-mcp-linux-amd64
- os: linux
arch: arm64
runs-on: ubuntu-latest
output: testops-mcp-linux-arm64
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version: '1.26'
- name: Build
env:
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.arch }}
run: |
mkdir -p build/releases
go build -ldflags "-X github.com/MimoJanra/TestOpsMCP/internal/mcp.Version=${{ github.ref_name }}" -o build/releases/${{ matrix.output }} ./cmd/server/main.go
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: ${{ matrix.output }}
path: build/releases/${{ matrix.output }}
release:
name: Create Release
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v6
- name: Download all artifacts
uses: actions/download-artifact@v8
with:
path: artifacts
- name: Flatten artifacts
run: |
mkdir -p release-assets
find artifacts -type f -exec mv {} release-assets/ \;
ls -la release-assets/
- name: Extract release notes from CHANGELOG
id: changelog
run: |
# Extract version number from tag
VERSION=${{ github.ref_name }}
# Extract section for this version from CHANGELOG.md
# This is a simplified extraction - adjust regex as needed
NOTES=$(sed -n "/## \[${VERSION#v}\]/,/## \[/p" CHANGELOG.md | head -n -1)
# If not found, use a default message
if [ -z "$NOTES" ]; then
NOTES="Release $VERSION"
fi
# Write to file for action
echo "$NOTES" > release_notes.txt
cat release_notes.txt
- name: Create or Update Release
uses: softprops/action-gh-release@v3
with:
files: release-assets/*
body_path: release_notes.txt
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}