Skip to content

change format

change format #466

Workflow file for this run

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\"
}}"