v0.2.16 #66
This file contains 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 | |
on: | |
pull_request: | |
branches: [main] | |
types: [labeled,closed] | |
jobs: | |
build-artifacts: | |
if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'release') | |
strategy: | |
matrix: | |
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 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Add target | |
run: rustup target add ${{ matrix.target }} | |
- name: Compile binary | |
run: cargo build --locked --release --target ${{ matrix.target }} | |
- name: Tar artifacts | |
run: | | |
cd target/${{ matrix.target }}/release | |
tar -czf ${{ matrix.target }}.tar.gz depot | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: ${{ matrix.target }} | |
path: target/${{ matrix.target }}/release/${{ matrix.target }}.tar.gz | |
publish-crates: | |
needs: build-artifacts | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install cargo-workspaces | |
uses: baptiste0928/cargo-install@v2 | |
with: | |
crate: cargo-workspaces | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Login to crates.io | |
run: cargo login ${{ secrets.CRATES_IO_TOKEN }} | |
- name: Publish crates | |
run: cargo ws publish --from-git --yes | |
- name: Add a tag for the merged commit | |
uses: christophebedard/tag-version-commit@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
version_regex: 'v([0-9]+\.[0-9]+\.[0-9]+)' | |
version_tag_prefix: 'v' | |
publish-artifacts: | |
needs: publish-crates | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v2 | |
- name: Publish artifacts | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ github.event.pull_request.title }} | |
files: | | |
x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu.tar.gz | |
x86_64-apple-darwin/x86_64-apple-darwin.tar.gz | |
aarch64-apple-darwin/aarch64-apple-darwin.tar.gz |