Skip to content

release

release #7

Workflow file for this run

name: release
permissions:
contents: write
on:
push:
tags:
- 'v[0-9]+.*'
env:
MACOSX_DEPLOYMENT_TARGET: '10.11'
jobs:
create-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: extract version
shell: bash
run: |
VERSION_TAG="${{ github.ref_name }}"
VERSION="${VERSION_TAG#v}"
echo "VERSION=${VERSION}" >> $GITHUB_ENV
echo "Version: ${VERSION}"
if ! grep -q "version = \"$VERSION\"" Cargo.toml; then
exit 1
fi
- run: 'gh release create "v${VERSION}" --draft --verify-tag --title "$VERSION"'
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
upload-binaries:
needs: create-release
strategy:
matrix:
include:
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
default-features: 'no-default-features'
features: rustls
- target: aarch64-unknown-linux-musl
os: ubuntu-latest
default-features: 'no-default-features'
features: rustls
#- target: aarch64-apple-darwin
# os: macos-latest
#- target: universal-apple-darwin
# os: macos-latest
runs-on: ${{ matrix.os }}
steps:
- run: sudo apt-get install -y musl-tools
if: "${{ contains(matrix.target, '-musl') }}"
- run: sudo apt-get install -y protobuf-compiler
if: "${{ contains(matrix.target, '-linux-') }}"
- run: brew install protobuf
if: "${{ contains(matrix.target, '-apple-darwin') }}"
- uses: actions/checkout@v4
- name: Install cross-compilation tools
uses: taiki-e/setup-cross-toolchain-action@v1
with:
target: "${{ matrix.target }}"
- uses: taiki-e/upload-rust-binary-action@v1
with:
bin: mairu
target: '${{ matrix.target }}'
tar: unix
no-default-features: "${{ matrix.default-features == 'no-default-features' }}"
features: ${{ matrix.features || '' }}
token: ${{ secrets.GITHUB_TOKEN }}
upload-debs:
needs: create-release
strategy:
matrix:
include:
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
- target: aarch64-unknown-linux-musl
os: ubuntu-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- run: sudo apt-get install -y musl-tools
if: "${{ contains(matrix.target, '-musl') }}"
- run: sudo apt-get install -y protobuf-compiler
if: "${{ contains(matrix.target, '-linux-') }}"
- uses: dtolnay/rust-toolchain@stable
with:
targets: "${{ matrix.target }}"
- name: Install cross-compilation tools
uses: taiki-e/setup-cross-toolchain-action@v1
with:
target: "${{ matrix.target }}"
- run: 'cargo install cargo-deb --locked'
- run: 'cargo deb --target=${{ matrix.target }}'
- run: 'gh release upload "${{ github.ref_name }}" target/debian/${{ matrix.target }}/*.deb'
shell: bash
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'