-
Notifications
You must be signed in to change notification settings - Fork 1
137 lines (118 loc) · 4.28 KB
/
Copy pathcli.yml
File metadata and controls
137 lines (118 loc) · 4.28 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
name: Cloud CLI release
on:
push:
tags:
- "cli-v*"
permissions:
contents: read
concurrency:
group: cli-release-${{ github.ref }}
cancel-in-progress: false
jobs:
verify:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
with:
bun-version: 1.3.14
- name: Validate release tag
run: |
[[ "$GITHUB_REF_NAME" =~ ^cli-v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$ ]] || {
echo "Cloud CLI releases must use cli-vX.Y.Z tags." >&2
exit 1
}
- run: bun ci
- run: bun run --cwd packages/ui build
- run: bun run --cwd packages/cloud-cli typecheck
- run: bun test packages/cloud-cli/src
build:
needs: verify
strategy:
fail-fast: false
matrix:
include:
- runner: macos-15
target: darwin_arm64
- runner: macos-15-intel
target: darwin_x64
- runner: ubuntu-24.04-arm
target: linux_arm64
- runner: ubuntu-latest
target: linux_x64
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
with:
bun-version: 1.3.14
- run: bun ci
- run: bun run --cwd packages/ui build
- name: Build CLI binary
env:
CLD_VERSION: ${{ github.ref_name }}
CLD_COMMIT: ${{ github.sha }}
CLD_TARGETS: ${{ matrix.target }}
CLD_OUTPUT_DIR: release
run: bun run --cwd packages/cloud-cli build
- name: Smoke test native binary
run: |
set -euo pipefail
binary="packages/cloud-cli/release/cld_${{ matrix.target }}"
"$binary" --version
"$binary" help
"$binary" update --version "${GITHUB_REF_NAME}" --yes --no-verify --no-skills
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: cld-${{ matrix.target }}
if-no-files-found: error
path: packages/cloud-cli/release/cld_${{ matrix.target }}
release:
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
pattern: cld-*
path: release
merge-multiple: true
- uses: sigstore/cosign-installer@398d4b0eeef1380460a10c8013a76f728fb906ac # v3
- name: Package release manifest
working-directory: release
run: |
set -euo pipefail
tar -czf cloud-cli-skill.tar.gz -C ../skills cloud-cli
chmod 755 cld_*
find . -maxdepth 1 -type f -regextype posix-extended -regex './(cld_(darwin|linux)_(arm64|x64)|cloud-cli-skill\.tar\.gz)' -printf '%f\n' | sort | while read -r file; do
sha256sum "$file"
done > checksums.txt
cosign sign-blob --yes \
--output-signature checksums.txt.sig \
--output-certificate checksums.txt.pem \
checksums.txt
- name: Publish GitHub Release
env:
GH_TOKEN: ${{ github.token }}
working-directory: release
run: |
set -euo pipefail
assets=(cld_* cloud-cli-skill.tar.gz checksums.txt checksums.txt.sig checksums.txt.pem)
if gh release view "${GITHUB_REF_NAME}" >/dev/null 2>&1; then
draft=$(gh release view "${GITHUB_REF_NAME}" --json isDraft --jq .isDraft)
[ "$draft" = "true" ] || {
echo "Release ${GITHUB_REF_NAME} is already published; refusing to replace immutable assets." >&2
exit 1
}
else
gh release create "${GITHUB_REF_NAME}" \
--title "Cloud CLI ${GITHUB_REF_NAME#cli-v}" \
--draft \
--verify-tag \
--generate-notes
fi
gh release upload "${GITHUB_REF_NAME}" "${assets[@]}" --clobber
gh release edit "${GITHUB_REF_NAME}" --draft=false --latest