Skip to content

Commit ea7c503

Browse files
committed
Publish release on tag
1 parent 14e4499 commit ea7c503

File tree

2 files changed

+98
-26
lines changed

2 files changed

+98
-26
lines changed

.github/workflows/build.yml

Lines changed: 10 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Build
22

33
on:
4-
push:
4+
pull_request:
55
branches:
66
- master
77
- main
@@ -12,37 +12,21 @@ on:
1212
- ".github/workflows/*.yml"
1313

1414
jobs:
15-
publish-linux:
16-
runs-on: ubuntu-latest
15+
check:
16+
runs-on: ubicloud
1717
timeout-minutes: 15
1818
steps:
1919
- name: Check out
20-
uses: actions/checkout@v2
20+
uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
2123
- name: Install ffi toolchain (1.76.0)
2224
run: |
2325
rustup install 1.76.0-x86_64-unknown-linux-gnu
2426
rustup default 1.76.0-x86_64-unknown-linux-gnu
25-
- name: Build Linux
26-
run: |
27-
cargo build --release
28-
- uses: actions/upload-artifact@v4
29-
with:
30-
path: "target/release/libdrift_ffi_sys.so"
31-
name: libdrift_ffi_sys.so
32-
publish-mac:
33-
runs-on: macos-latest
34-
timeout-minutes: 15
35-
steps:
36-
- name: Check out
37-
uses: actions/checkout@v2
38-
- name: Install ffi toolchain (1.76.0)
27+
- name: fmt
3928
run: |
40-
rustup install 1.76.0-x86_64-apple-darwin
41-
rustup default 1.76.0-x86_64-apple-darwin
42-
- name: Build Mac
29+
cargo fmt --check
30+
- name: build
4331
run: |
44-
cargo build --release
45-
- uses: actions/upload-artifact@v4
46-
with:
47-
path: "target/release/libdrift_ffi_sys.dylib"
48-
name: libdrift_ffi_sys.dylib
32+
cargo check

.github/workflows/release.yml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
create-release-preflight:
10+
runs-on: ubicloud
11+
steps:
12+
- name: Check out
13+
uses: actions/checkout@v4
14+
15+
- name: Check tag matches Cargo.toml version
16+
run: |
17+
TAG=${GITHUB_REF#refs/tags/v}
18+
if [ "$TAG" != "${{ env.CARGO_VERSION }}" ]; then
19+
echo "Error: Git tag ($TAG) does not match Cargo.toml version (${{ env.CARGO_VERSION }})"
20+
exit 1
21+
fi
22+
23+
publish-linux:
24+
runs-on: ubicloud
25+
needs: [create-release-preflight]
26+
timeout-minutes: 15
27+
steps:
28+
- name: Check out
29+
uses: actions/checkout@v4
30+
with:
31+
fetch-depth: 0
32+
- name: Install ffi toolchain (1.76.0)
33+
run: |
34+
rustup install 1.76.0-x86_64-unknown-linux-gnu
35+
rustup default 1.76.0-x86_64-unknown-linux-gnu
36+
- name: Build Linux
37+
run: |
38+
cargo build --release
39+
- uses: actions/upload-artifact@v4
40+
with:
41+
path: "target/release/libdrift_ffi_sys.so"
42+
name: libdrift_ffi_sys.so
43+
44+
publish-mac:
45+
runs-on: macos-latest
46+
needs: [create-release-preflight]
47+
timeout-minutes: 15
48+
steps:
49+
- name: Check out
50+
uses: actions/checkout@v4
51+
with:
52+
fetch-depth: 0
53+
- name: Install ffi toolchain (1.76.0)
54+
run: |
55+
rustup install 1.76.0-x86_64-apple-darwin
56+
rustup default 1.76.0-x86_64-apple-darwin
57+
- name: Build Mac
58+
run: |
59+
cargo build --release
60+
- uses: actions/upload-artifact@v4
61+
with:
62+
path: "target/release/libdrift_ffi_sys.dylib"
63+
name: libdrift_ffi_sys.dylib
64+
65+
create-release:
66+
needs: [create-release-preflight, publish-linux, publish-mac]
67+
runs-on: ubicloud
68+
permissions:
69+
contents: write
70+
steps:
71+
- name: Check out
72+
uses: actions/checkout@v4
73+
74+
- name: Get version from Cargo.toml
75+
run: |
76+
echo "CARGO_VERSION=$(grep '^version = ' Cargo.toml | cut -d '"' -f2)" >> $GITHUB_ENV
77+
78+
- name: Download all artifacts
79+
uses: actions/download-artifact@v4
80+
81+
- name: Create Release
82+
uses: softprops/action-gh-release@v1
83+
with:
84+
name: v${{ env.CARGO_VERSION }}
85+
files: |
86+
libdrift_ffi_sys.so/libdrift_ffi_sys.so
87+
libdrift_ffi_sys.dylib/libdrift_ffi_sys.dylib
88+
generate_release_notes: true

0 commit comments

Comments
 (0)