-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (74 loc) · 2.78 KB
/
Copy pathrelease.yml
File metadata and controls
84 lines (74 loc) · 2.78 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
name: Release
on:
push:
tags:
- 'v*.*.*'
permissions:
contents: write
id-token: write
attestations: write
concurrency:
group: vsphere-cli-bundle-release-${{ github.ref }}
cancel-in-progress: false
jobs:
release:
runs-on: ubuntu-24.04
timeout-minutes: 45
steps:
- name: Check out immutable tag
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- name: Validate release identity
shell: bash
run: |
set -euo pipefail
test "$GITHUB_REF_TYPE" = tag
version="${GITHUB_REF_NAME#v}"
[[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]
test "$(git rev-parse HEAD)" = "$(git rev-list -n 1 "$GITHUB_REF_NAME")"
test "$(sed -n 's/^GOVMOMI_VERSION=//p' sources.lock.env)" = "$version"
test -z "$(git status --porcelain)"
- name: Install checksum-pinned Go toolchain
shell: bash
run: |
set -euo pipefail
archive="$RUNNER_TEMP/go1.27.0.linux-amd64.tar.gz"
curl --proto '=https' --tlsv1.2 --fail --silent --show-error --location \
--output "$archive" https://go.dev/dl/go1.27.0.linux-amd64.tar.gz
printf '%s %s\n' \
675c26c449cbb18fc24b74650de1eabbae6e16f64326fd85a283fb3b58280685 \
"$archive" | sha256sum -c -
tar -C "$RUNNER_TEMP" -xzf "$archive"
printf '%s\n' "$RUNNER_TEMP/go/bin" >> "$GITHUB_PATH"
- name: Rebuild and verify exact bundle
shell: bash
run: |
set -euo pipefail
scripts/test
scripts/package dist
version="${GITHUB_REF_NAME#v}"
artifact="dist/vsphere-cli-bundle-${version}-linux-amd64.tar.xz"
test -s "$artifact"
(cd dist && sha256sum "${artifact##*/}" > SHA256SUMS)
- name: Attest release asset
uses: actions/attest-build-provenance@4d101475d8b20a2381f78447822ac1eab6504dd8 # v4.2.2
with:
subject-checksums: dist/SHA256SUMS
- name: Publish immutable GitHub release
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
version="${GITHUB_REF_NAME#v}"
artifact="dist/vsphere-cli-bundle-${version}-linux-amd64.tar.xz"
gh release create "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" --verify-tag \
--title "vSphere CLI Bundle ${version}" \
--notes 'Deterministic Go 1.27.0 build from the pinned govmomi source coordinate, with pure numeric artifact versioning and checksummed provenance.' \
"$artifact" dist/SHA256SUMS
- name: Clean generated files
if: always()
shell: bash
run: rm -rf -- dist