-
-
Notifications
You must be signed in to change notification settings - Fork 5
125 lines (110 loc) · 3.81 KB
/
Copy pathrelease_stackablectl.yml
File metadata and controls
125 lines (110 loc) · 3.81 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
---
name: Stackablectl Release Pipeline
permissions: {}
on:
push:
tags:
- "stackablectl-[0-9]+.[0-9]+.[0-9]+**"
env:
CARGO_CYCLONEDX_VERSION: 0.5.7
RUST_VERSION: 1.95.0
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: "0"
CARGO_PROFILE_DEV_DEBUG: "0"
RUSTFLAGS: "-D warnings"
RUSTDOCFLAGS: "-D warnings"
RUST_LOG: "info"
RELEASE_TAG: ${{ github.ref_name }}
jobs:
create-release:
name: Create Draft Release
runs-on: ubuntu-latest
permissions:
contents: write # required to draft the release
steps:
# This checkout is only here so that a .git directory is present because the gh CLI needs it.
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Create Draft Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release create --draft --verify-tag "$RELEASE_TAG"
release:
name: Release for ${{ matrix.target }}
runs-on: ${{ matrix.os }}
needs:
- create-release
permissions:
contents: write # required to upload release binaries and SBOM assets to the GitHub Release
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-24.04
file-suffix: ""
- target: aarch64-unknown-linux-gnu
os: ubuntu-24.04-arm
file-suffix: ""
- target: x86_64-apple-darwin
os: macos-latest
file-suffix: ""
- target: aarch64-apple-darwin
os: macos-latest
file-suffix: ""
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
submodules: recursive
- uses: dtolnay/rust-toolchain@6c977a6ca4077a0ceb28ffbe03f59d46e9ac8772 # v1
with:
toolchain: ${{ env.RUST_VERSION }}
targets: ${{ matrix.target }}
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: '^1.26.0'
- name: Install cargo-cyclonedx
run: cargo install --locked cargo-cyclonedx@"$CARGO_CYCLONEDX_VERSION"
- name: Build Binary
if: matrix.os != 'windows-latest'
env:
TARGET: ${{ matrix.target }}
run: cargo build --target "$TARGET" --release --package stackablectl
- name: Generate SBOM
run: cargo cyclonedx --all --spec-version 1.5 --describe binaries
- name: Rename Binary
env:
TARGET: ${{ matrix.target }}
FILE_SUFFIX: ${{ matrix.file-suffix }}
run: mv "target/$TARGET/release/stackablectl$FILE_SUFFIX" "stackablectl-$TARGET$FILE_SUFFIX"
- name: Rename SBOM
env:
TARGET: ${{ matrix.target }}
run: mv rust/stackablectl/stackablectl_bin.cdx.xml "stackablectl-$TARGET.cdx.xml"
- name: Upload Release Binary and SBOM
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TARGET: ${{ matrix.target }}
FILE_SUFFIX: ${{ matrix.file-suffix }}
run: gh release upload "$RELEASE_TAG" "stackablectl-$TARGET$FILE_SUFFIX" "stackablectl-$TARGET.cdx.xml"
finish-release:
name: Finish Release
needs:
- release
runs-on: ubuntu-latest
permissions:
contents: write # required to finalize the release
steps:
# This checkout is only here so that a .git directory is present because the gh CLI needs it.
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Finish Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release edit --draft=false --latest "$RELEASE_TAG"