-
Notifications
You must be signed in to change notification settings - Fork 7
131 lines (127 loc) · 4.23 KB
/
Copy pathrelease.yml
File metadata and controls
131 lines (127 loc) · 4.23 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
name: Release
on:
push:
tags:
- 'v*.*.*'
workflow_dispatch:
inputs:
version:
description: "Version to build (without leading 'v')"
required: true
permissions:
contents: write # needed for softprops/action-gh-release
env:
CARGO_TERM_COLOR: always
jobs:
build:
name: Build (${{ matrix.target }})
runs-on: ${{ matrix.runner }}
timeout-minutes: 90
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
runner: ubuntu-24.04
os_label: linux
- target: aarch64-unknown-linux-gnu
runner: ubuntu-24.04-arm
os_label: linux
# x86_64-apple-darwin temporarily disabled: GitHub is deprecating
# macos-13 runners and jobs queue 24h+ before timing out. Restore
# this row once a macos-* Intel runner is reliably available again.
- target: aarch64-apple-darwin
runner: macos-14
os_label: macos
env:
CC: clang
CXX: clang++
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Install protobuf (Linux)
if: matrix.os_label == 'linux'
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler
- name: Install protobuf (macOS)
if: matrix.os_label == 'macos'
run: brew install protobuf
- name: Resolve version
id: ver
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "version=${{ inputs.version }}" >>"$GITHUB_OUTPUT"
else
echo "version=${GITHUB_REF_NAME#v}" >>"$GITHUB_OUTPUT"
fi
- name: Configure + build
run: |
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --parallel
- name: Install to staging prefix
run: cmake --install build --prefix stage
- name: Tar
id: pack
run: |
VERSION=${{ steps.ver.outputs.version }}
TARGET=${{ matrix.target }}
ARCHIVE="lance-c-v${VERSION}-${TARGET}.tar.xz"
tar -C stage -cJf "${ARCHIVE}" .
shasum -a 256 "${ARCHIVE}" > "${ARCHIVE}.sha256"
shasum -a 512 "${ARCHIVE}" > "${ARCHIVE}.sha512"
echo "archive=${ARCHIVE}" >>"$GITHUB_OUTPUT"
- name: Upload as workflow artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}
path: |
${{ steps.pack.outputs.archive }}
${{ steps.pack.outputs.archive }}.sha256
${{ steps.pack.outputs.archive }}.sha512
if-no-files-found: error
retention-days: 14
publish:
name: Publish GitHub Release
needs: build
runs-on: ubuntu-24.04
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: Aggregate SHA512SUMS
run: |
cd dist
cat *.sha512 > SHA512SUMS
ls -lah
- name: Emit recipe-update snippet
run: |
cd dist
echo "## Suggested recipe updates" > recipe-snippets.md
echo '```cmake' >> recipe-snippets.md
echo '# ports/lance-c/portfile.cmake — paste these set() lines' >> recipe-snippets.md
for f in *.tar.xz; do
sha=$(awk '{print $1}' "${f}.sha512")
triple_target="${f#lance-c-v*-}"
triple_target="${triple_target%.tar.xz}"
echo "set(LANCE_C_SHA512_${triple_target} \"${sha}\")"
done >> recipe-snippets.md
echo '```' >> recipe-snippets.md
cat recipe-snippets.md
- name: Publish release
uses: softprops/action-gh-release@v2
with:
files: |
dist/*.tar.xz
dist/*.sha256
dist/*.sha512
dist/SHA512SUMS
generate_release_notes: true
fail_on_unmatched_files: true
prerelease: ${{ contains(github.ref_name, '-beta') || contains(github.ref_name, '-rc') }}