-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (57 loc) · 2.1 KB
/
cli_release.yaml
File metadata and controls
65 lines (57 loc) · 2.1 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
name: CLI Release
on:
push:
workflow_dispatch:
permissions:
contents: write
jobs:
build-and-release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
- name: Set build variables
id: vars
run: |
echo "version=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT
echo "short_sha=${GITHUB_SHA::7}" >> $GITHUB_OUTPUT
echo "build_timestamp=$(date -u +"%Y-%m-%dT%H:%M:%SZ")" >> $GITHUB_OUTPUT
- name: Build CLI binaries
working-directory: cli
run: |
make build-all \
VERSION=${{ steps.vars.outputs.version }} \
COMMIT_SHA=${{ github.sha }} \
SHORT_SHA=${{ steps.vars.outputs.short_sha }} \
BUILD_TIMESTAMP=${{ steps.vars.outputs.build_timestamp }} \
GIT_REF=${{ github.ref_name }}
- name: Upload workflow artifacts
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: tools-cli-binaries
path: |
cli/tools-linux-amd64
cli/tools-linux-arm64
cli/tools-darwin-amd64
cli/tools-darwin-arm64
- name: Delete existing release for this ref
if: startsWith(github.ref, 'refs/tags/v')
run: gh release delete "${{ github.ref_name }}" --yes 2>/dev/null || true
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create GitHub Release
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@1853d73993c8ca1b2c9c1a7fede39682d0ab5c2a # v2.5.3
with:
tag_name: ${{ github.ref_name }}
name: ${{ github.ref_name }}
prerelease: ${{ !startsWith(github.ref, 'refs/tags/v') }}
files: |
cli/tools-linux-amd64
cli/tools-linux-arm64
cli/tools-darwin-amd64
cli/tools-darwin-arm64
body: |
CLI binaries built from `${{ github.sha }}` on `${{ github.ref_name }}`.