-
Notifications
You must be signed in to change notification settings - Fork 6
151 lines (132 loc) · 5.67 KB
/
release.yml
File metadata and controls
151 lines (132 loc) · 5.67 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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Release
on:
release:
types: [created]
workflow_dispatch:
inputs:
tag_name:
description: 'The tag of the release to upload assets to (e.g. v0.1.0)'
required: true
type: string
permissions:
contents: write
jobs:
prep-release:
uses: ./.github/workflows/prep-release.yaml
with:
release: ${{ github.event.release.tag_name || inputs.tag_name }}
build-release:
needs: prep-release
runs-on: ubuntu-latest
defaults:
run:
working-directory: devops-mcp-server
env:
RELEASE_DIR: "${{ github.workspace }}/release"
DIST_DIR: "${{ github.workspace }}/dist"
strategy:
matrix:
platform:
- {
goos: "linux",
goarch: "amd64",
bin_file: "devops-mcp-server",
archive: "linux.x64.devops.tar.gz",
archive_cmd: 'tar -czvf "${ARCHIVE_PATH}" -C "${RELEASE_DIR}" .',
}
- {
goos: "darwin",
goarch: "arm64",
bin_file: "devops-mcp-server",
archive: "darwin.arm64.devops.tar.gz",
archive_cmd: 'tar -czvf "${ARCHIVE_PATH}" -C "${RELEASE_DIR}" .',
}
- {
goos: "windows",
goarch: "amd64",
bin_file: "devops-mcp-server.exe",
archive: "win32.x64.devops.zip",
archive_cmd: 'cd "${RELEASE_DIR}" && zip -r "${ARCHIVE_PATH}" .',
}
steps:
- uses: actions/checkout@v4
with:
# Do not checkout 'main'. Checkout the exact SHA prep-release used.
ref: ${{ needs.prep-release.outputs.release_sha }}
- name: prep-release
env:
BIN_FILE: "${{ matrix.platform.bin_file }}"
TAG_NAME: ${{ github.event.release.tag_name || inputs.tag_name }}
run: |
mkdir -p "${RELEASE_DIR}"
# Extract version from tag (v1.2.3 -> 1.2.3)
VERSION="${TAG_NAME#v}"
command_exp='.mcpServers."devops-mcp".command = "${extensionPath}${/}'
command_exp="${command_exp}${BIN_FILE}\""
command_exp="${command_exp} | .version = \"${VERSION}\""
jq "${command_exp}" < ../gemini-extension.json >"${RELEASE_DIR}/gemini-extension.json"
cp ../README.md "${RELEASE_DIR}/"
cp ../LICENSE "${RELEASE_DIR}/"
cp -r ../skills "${RELEASE_DIR}/"
- name: Set up Go
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00
with:
go-version: "1.24.8"
- name: Download Dependencies
run: go mod tidy
- name: Build
run: |
export GOOS=${{ matrix.platform.goos }}
export GOARCH=${{ matrix.platform.goarch }}
output_path="${RELEASE_DIR}/${{ matrix.platform.bin_file }}"
go build -o "${output_path}"
- name: Create release assets
id: archive
run: |
mkdir -p "${DIST_DIR}"
echo "Creating ${{ matrix.platform.archive }}"
export ARCHIVE_PATH="${DIST_DIR}/${{ matrix.platform.archive }}"
sh -c "${{ matrix.platform.archive_cmd }}"
echo "Created ${ARCHIVE_PATH}"
echo "ARCHIVE_NAME=${{ matrix.platform.archive }}" >> "$GITHUB_OUTPUT"
- name: Upload archive as artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: ${{ steps.archive.outputs.ARCHIVE_NAME }}
path: ${{ github.workspace }}/dist/*
upload-assets:
needs: [build-release]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
- name: Download all archives from artifacts
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5
with:
path: artifacts
- name: List downloaded files
run: |
echo "--- Downloaded files ---"
ls -Rlrt artifacts/*
echo "------------------------"
- name: Upload release assets
id: upload-assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG_NAME: ${{ github.event.release.tag_name || inputs.tag_name }}
run: |
gh release upload --clobber \
${TAG_NAME} \
artifacts/*/*