Skip to content

Release

Release #81

Workflow file for this run

# CI that:
#
# * checks for a Git Tag that looks like a release ("v1.2.0")
# * creates a Github Release™️
# * builds binaries/packages with cargo-dist
# * uploads those packages to the Github Release™️
#
# Note that the Github Release™️ will be created before the packages,
# so there will be a few minutes where the release has no packages
# and then they will slowly trickle in, possibly failing. To make
# this more pleasant we mark the release as a "draft" until all
# artifacts have been successfully uploaded. This allows you to
# choose what to do with partial successes and avoids spamming
# anyone with notifications before the release is actually ready.
name: Release
permissions:
contents: write
on:
workflow_dispatch:
inputs:
level:
description: 'Release level'
required: true
default: 'patch'
type: choice
options:
- patch
- minor
- major
jobs:
# Build and packages all the things
build-binaries:
strategy:
matrix:
# For these target platforms
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-apple-darwin
os: macos-latest
- target: aarch64-apple-darwin
os: macos-latest
#- target: x86_64-pc-windows-msvc
# os: windows-latest
runs-on: ${{ matrix.os }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
- name: Install Rust
run: |
rustup update stable
rustup default stable
- name: Install cargo-zigbuild
run: |
pip3 install ziglang
cargo install cargo-zigbuild
- name: Setup target
run: rustup target add ${{ matrix.target }}
- name: Run cargo zigbuild
run: |
cargo zigbuild --release --target ${{ matrix.target }}
- name: Compress artifacts
run: |
tar -cvzf wheel_${{ matrix.target }}.tar.gz -C target/${{ matrix.target }}/release wheel
- name: Archive artifact
uses: actions/upload-artifact@v3
with:
name: wheel_${{ matrix.target }}
path: |
wheel_${{ matrix.target }}.tar.gz
bump-versions:
needs: [build-binaries]
runs-on: ubuntu-latest
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_TOKEN }}
outputs:
tag: ${{ steps.release.outputs.tag }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- id: install-cargo-release
uses: taiki-e/install-action@v1
with:
tool: cargo-release
- id: release
run: |
git config user.email "github@3box.io"
git config user.name "Github Automation"
echo "tag="$(cargo metadata --format-version=1 --no-deps | jq '.packages[0].version' | tr -d '"') >> $GITHUB_OUTPUT
cargo release -vv ${{ inputs.level }} -x --no-confirm
publish-release:
needs: [bump-versions]
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
path: artifacts
- name: check artifacts
run: |
ls artifacts/**/*.tar.gz
- name: create release
run: |
echo "Creating release for "${{ needs.bump-versions.outputs.tag }}
gh release create v${{ needs.bump-versions.outputs.tag }} --title "v"${{ needs.bump-versions.outputs.tag }} --latest artifacts/**/*.tar.gz