|
| 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