-
Notifications
You must be signed in to change notification settings - Fork 0
141 lines (123 loc) · 4.4 KB
/
Copy pathrelease.yml
File metadata and controls
141 lines (123 loc) · 4.4 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
138
139
140
141
# .github/workflows/release.yml
name: Release CLI
on:
push:
tags:
- '*.*.*' # semver-ish tags like 0.9.0 (repo uses non-v tags)
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
jobs:
# ---------- 1. Build binaries ----------
build-binaries:
name: Build runbeam-cli binaries (cross/native)
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
- os: ubuntu-latest
target: aarch64-unknown-linux-musl
- os: windows-latest
target: x86_64-pc-windows-msvc
- os: macos-latest
target: x86_64-apple-darwin
- os: macos-latest
target: aarch64-apple-darwin
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
# Linux builds use cross
- name: Build runbeam-cli (Linux cross)
if: runner.os == 'Linux'
shell: bash
run: |
cargo install cross --git https://github.com/cross-rs/cross
cross build --release --target ${{ matrix.target }}
# Non-Linux builds are native
- name: Build runbeam-cli (native)
if: runner.os != 'Linux'
run: cargo build --release --target ${{ matrix.target }}
- name: Package artefacts (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
New-Item -ItemType Directory -Force -Path release | Out-Null
Compress-Archive -Path "target/${{ matrix.target }}/release/runbeam.exe" -DestinationPath "release/runbeam-${{ matrix.target }}.zip" -Force
Get-FileHash "release/runbeam-${{ matrix.target }}.zip" -Algorithm SHA256 | ForEach-Object { $_.Hash + " runbeam-${{ matrix.target }}.zip" } | Out-File "release/runbeam-${{ matrix.target }}.sha256" -Encoding ascii
- name: Package artefacts (Unix)
if: runner.os != 'Windows'
shell: bash
run: |
mkdir -p release
tar czf release/runbeam-${{ matrix.target }}.tar.gz -C target/${{ matrix.target }}/release runbeam
cd release
shasum -a 256 runbeam-${{ matrix.target }}.tar.gz > runbeam-${{ matrix.target }}.sha256
- name: Upload artefacts
uses: actions/upload-artifact@v4
with:
name: runbeam-${{ matrix.target }}
path: release/
# ---------- 3. Publish GitHub Release ----------
release:
name: Publish GitHub Release
runs-on: ubuntu-latest
needs: [build-binaries]
if: startsWith(github.ref, 'refs/tags/')
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download runbeam build artefacts only
uses: actions/download-artifact@v4
with:
path: ./artifacts
pattern: runbeam-*
merge-multiple: true
- name: Generate combined checksums manifest
shell: bash
run: |
cd artifacts
find . -type f -name "*.sha256" -exec cat {} \; > checksums.txt
echo "Combined checksums:"
cat checksums.txt
- name: Delete existing release if present
shell: bash
run: |
if gh release view ${{ github.ref_name }} &>/dev/null; then
echo "Release exists, deleting..."
gh release delete ${{ github.ref_name }} --yes --cleanup-tag
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
name: runbeam-cli ${{ github.ref_name }}
files: ./artifacts/**/*
draft: true
make_latest: false
fail_on_unmatched_files: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Verify release
shell: bash
run: |
echo "Verifying release was created successfully..."
gh release view ${{ github.ref_name }} --json assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish release
shell: bash
run: |
echo "Publishing release ${{ github.ref_name }}..."
gh release edit ${{ github.ref_name }} --draft=false --latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}