-
Notifications
You must be signed in to change notification settings - Fork 2
115 lines (102 loc) · 3.47 KB
/
release.yml
File metadata and controls
115 lines (102 loc) · 3.47 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
name: Release
on:
# manual update
push:
tags:
- "v*"
# automated update
workflow_run:
workflows: ["Bump program version"]
types:
- completed
jobs:
create-release-preflight:
runs-on: ubicloud
# Only run if triggered manually by tag or if the upstream workflow succeeded
if: github.event_name == 'push' || github.event.workflow_run.conclusion == 'success'
steps:
- name: Check out
uses: actions/checkout@v4
- name: Get version from Cargo.toml
run: |
echo "CARGO_VERSION=$(grep '^version = ' Cargo.toml | cut -d '"' -f2)" >> $GITHUB_ENV
# For tag trigger: Check that tag matches Cargo.toml version
- name: Validate tag match for tag trigger
if: github.event_name == 'push'
run: |
TAG=${GITHUB_REF#refs/tags/v}
if [ "$TAG" != "${{ env.CARGO_VERSION }}" ]; then
echo "Error: Git tag ($TAG) does not match Cargo.toml version (${{ env.CARGO_VERSION }})"
exit 1
fi
echo "Tag validation successful"
publish-linux:
runs-on: ubicloud
needs: [create-release-preflight]
timeout-minutes: 15
steps:
- name: Check out
uses: actions/checkout@v4
- name: Install ffi toolchain (1.76.0)
run: |
rustup install 1.76.0-x86_64-unknown-linux-gnu
rustup default 1.76.0-x86_64-unknown-linux-gnu
- name: Build Linux
run: |
cargo build --release
- uses: actions/upload-artifact@v4
with:
path: "target/release/libdrift_ffi_sys.so"
name: libdrift_ffi_sys.so
publish-mac:
runs-on: macos-latest
needs: [create-release-preflight]
timeout-minutes: 15
steps:
- name: Check out
uses: actions/checkout@v4
- name: Install ffi toolchain (1.76.0)
run: |
rustup toolchain install 1.76.0
rustup default 1.76.0
rustup target add x86_64-apple-darwin
- name: Build Mac
run: |
cargo build --release --target x86_64-apple-darwin
- uses: actions/upload-artifact@v4
with:
path: "target/x86_64-apple-darwin/release/libdrift_ffi_sys.dylib"
name: libdrift_ffi_sys.dylib
create-release:
needs: [create-release-preflight, publish-linux, publish-mac]
runs-on: ubicloud
permissions:
contents: write
steps:
- name: Check out
uses: actions/checkout@v4
- name: Get version from Cargo.toml
run: |
echo "CARGO_VERSION=$(grep '^version = ' Cargo.toml | cut -d '"' -f2)" >> $GITHUB_ENV
- name: Download all artifacts
uses: actions/download-artifact@v4
- name: Create Release
uses: softprops/action-gh-release@v2
with:
name: v${{ env.CARGO_VERSION }}
files: |
libdrift_ffi_sys.so/libdrift_ffi_sys.so
libdrift_ffi_sys.dylib/libdrift_ffi_sys.dylib
generate_release_notes: true
tag_name: v${{ env.CARGO_VERSION }}
- name: Emit dispatch event
run: |
VERSION="v${{ env.CARGO_VERSION }}"
curl -X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: token ${{ secrets.GH_PAT }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/repos/drift-labs/drift-rs/dispatches" \
-d "{\"event_type\": \"libdrift-update\", \"client_payload\": {
\"version\": \"$VERSION\"
}}"