bump version #7
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release tagged versions | |
on: | |
push: | |
tags: | |
- 'v[0-9]+.[0-9]+.[0-9]+' | |
workflow_dispatch: | |
env: | |
SQLX_OFFLINE: true | |
jobs: | |
build: | |
name: Build for multiple targets | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
target: ["x86_64-unknown-linux-gnu", "x86_64-unknown-linux-musl", "aarch64-unknown-linux-gnu", "aarch64-unknown-linux-musl", "armv7-unknown-linux-gnueabi"] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: ${{ matrix.target }} | |
- name: Cache build dependencies | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/bin | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
key: ${{ runner.os }}-cargo-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
${{ runner.os }}-cargo-${{ matrix.target }}- | |
- name: Install cross | |
run: cargo install cross --git https://github.com/cross-rs/cross | |
- name: Extract binary name from Cargo.toml | |
id: get-binary-name | |
uses: mathiasvr/command-output@v2.0.0 | |
continue-on-error: false | |
with: | |
run: "cargo metadata --format-version 1 --no-deps | jq -j -r '.packages[0].targets[0].name'" | |
- name: Build | |
run: cross build --locked --release --target ${{ matrix.target }} | |
# Note: This will not work with Windows builds! | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.get-binary-name.outputs.stdout }}-${{ matrix.target }} | |
path: target/${{ matrix.target }}/release/${{ steps.get-binary-name.outputs.stdout }} | |
release: | |
name: Create GitHub Release | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Download all build artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: artifacts | |
- name: Rename artifacts and move them to a flat structure | |
run: | | |
mkdir -p release-artifacts | |
for dir in artifacts/*; do | |
binary_name=$(basename "$dir") | |
dir_content=($dir/*) | |
artifact_name=${dir_content[0]} | |
mv "$artifact_name" "release-artifacts/$binary_name" | |
done | |
- name: Remove artifact downloads | |
run: rm -rf artifacts | |
- name: Create Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
fail_on_unmatched_files: true | |
tag_name: ${{ github.ref_name }} | |
name: ${{ github.ref_name }} | |
draft: false | |
prerelease: true | |
files: release-artifacts/* |