ci: add GitHub binary release workflow
Build the asc CLI for linux/windows/macOS (amd64 + arm64), checksum each asset, and publish a GitHub release with auto-generated notes. Mirrors the smbcloud-cli release-github.yml, trimmed to what ascapi needs: toolchain pinned to stable (no rust-toolchain.toml here) and no OS-package-manager fan-out (no homebrew/scoop/winget workflows in this repo yet). Co-Authored-By: siGit Code v1.6.7-acp <noreply@sigit.si>
Seto Elkahfi committed
Oct 11, 2026 at 20:11 UTC
30f50d58c0f75c2660454012fc189259d9c6dbb2
1 file changed
+147
.github/workflows/release-github.yml
new
+147
@@ -0,0 +1,147 @@
1
+name: GitHub Release
2
+
3
+on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ tag:
7
+ description: "Release tag (e.g. v0.2.0)"
8
+ required: true
9
+
10
+permissions:
11
+ contents: write
12
+
13
+env:
14
+ PROJECT_NAME: asc
15
+ CARGO_TERM_COLOR: always
16
+
17
+jobs:
18
+ build:
19
+ name: Build binary (${{ matrix.name }})
20
+ runs-on: ${{ matrix.runner }}
21
+
22
+ strategy:
23
+ fail-fast: false
24
+ matrix:
25
+ include:
26
+ - name: linux-amd64
27
+ runner: ubuntu-latest
28
+ target: x86_64-unknown-linux-gnu
29
+ - name: linux-arm64
30
+ runner: ubuntu-24.04-arm
31
+ target: aarch64-unknown-linux-gnu
32
+ - name: win-amd64
33
+ runner: windows-latest
34
+ target: x86_64-pc-windows-msvc
35
+ - name: win-arm64
36
+ runner: windows-latest
37
+ target: aarch64-pc-windows-msvc
38
+ - name: macos-amd64
39
+ runner: macos-15-intel
40
+ target: x86_64-apple-darwin
41
+ - name: macos-arm64
42
+ runner: macos-latest
43
+ target: aarch64-apple-darwin
44
+
45
+ steps:
46
+ - name: Checkout
47
+ uses: actions/checkout@v6
48
+ with:
49
+ ref: ${{ github.event.inputs.tag || github.ref }}
50
+
51
+ - name: Set the release version
52
+ shell: bash
53
+ run: |
54
+ if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then
55
+ release_version="${GITHUB_REF_NAME#v}"
56
+ else
57
+ release_version="${{ github.event.inputs.tag }}"
58
+ release_version="${release_version#v}"
59
+ fi
60
+
61
+ echo "RELEASE_VERSION=${release_version}" >> "$GITHUB_ENV"
62
+
63
+ - name: Install toolkit
64
+ uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9
65
+ with:
66
+ toolchain: stable
67
+ targets: ${{ matrix.target }}
68
+
69
+ - name: Setup Rust cache
70
+ uses: Swatinem/rust-cache@v2
71
+ with:
72
+ key: github-${{ matrix.target }}
73
+
74
+ - name: Build binary
75
+ shell: bash
76
+ run: cargo build --locked --release --target ${{ matrix.target }} --package smbcloud-ascapi-cli
77
+
78
+ - name: Package binary
79
+ shell: bash
80
+ run: |
81
+ BIN_SUFFIX=""
82
+ if [[ "${{ matrix.runner }}" == "windows-latest" ]]; then
83
+ BIN_SUFFIX=".exe"
84
+ fi
85
+
86
+ BIN_OUTPUT="target/${{ matrix.target }}/release/${PROJECT_NAME}${BIN_SUFFIX}"
87
+ BIN_RELEASE="${PROJECT_NAME}-${{ matrix.name }}${BIN_SUFFIX}"
88
+
89
+ mkdir -p ./release
90
+ mv "${BIN_OUTPUT}" "./release/${BIN_RELEASE}"
91
+
92
+ # Windows runners use bash from Git for Windows, which has sha256sum;
93
+ # macOS only has shasum.
94
+ - name: Checksum release assets
95
+ shell: bash
96
+ run: |
97
+ cd release
98
+ for asset in *; do
99
+ case "${asset}" in *.sha256) continue ;; esac
100
+
101
+ if command -v sha256sum >/dev/null 2>&1; then
102
+ sha256sum "${asset}" | awk '{print $1}' > "${asset}.sha256"
103
+ else
104
+ shasum -a 256 "${asset}" | awk '{print $1}' > "${asset}.sha256"
105
+ fi
106
+
107
+ echo "${asset}: $(cat "${asset}.sha256")"
108
+ done
109
+
110
+ - name: Upload binary artifact
111
+ uses: actions/upload-artifact@v7
112
+ with:
113
+ name: binary-${{ matrix.name }}
114
+ path: release/*
115
+
116
+ release:
117
+ name: Create GitHub Release
118
+ needs: build
119
+ runs-on: ubuntu-latest
120
+ if: github.ref_type == 'tag' || github.event_name == 'workflow_dispatch'
121
+
122
+ steps:
123
+ - name: Resolve tag
124
+ id: tag
125
+ shell: bash
126
+ run: |
127
+ if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
128
+ echo "tag=${{ github.event.inputs.tag }}" >> "$GITHUB_OUTPUT"
129
+ else
130
+ echo "tag=${{ github.ref_name }}" >> "$GITHUB_OUTPUT"
131
+ fi
132
+
133
+ - name: Download binary artifacts
134
+ uses: actions/download-artifact@v7
135
+ with:
136
+ pattern: "binary-*"
137
+ path: release
138
+ merge-multiple: true
139
+
140
+ - name: Release
141
+ uses: softprops/action-gh-release@v2
142
+ with:
143
+ tag_name: ${{ steps.tag.outputs.tag }}
144
+ files: release/*
145
+ # Build the notes from the PRs since the previous tag, the same
146
+ # format as the "Generate release notes" button on the web UI.
147
+ generate_release_notes: true