Skip to content

.github/workflows/release.yml #18

.github/workflows/release.yml

.github/workflows/release.yml #18

Workflow file for this run

on:
release:
types: [created]
push:
tags:
- v[0-9]+.*
jobs:
release:
name: release ${{ matrix.target }}
runs-on: ${{ matrix.os }}
if: github.event_name == 'release'
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
archive: tar.gz
os: ubuntu-latest
bin: rsvenv
name: rsvenv-x86_64-unknown-linux-gnu.tar.gz
- target: aarch64-apple-darwin
archive: zip
os: macos-latest
bin: rsvenv
name: rsvenv-aarch64-apple-darwin.tar.gz
- target: x86_64-apple-darwin
archive: zip
os: macos-latest
bin: rsvenv
name: rsvenv-x86_64-apple-darwin.tar.gz
steps:
- name: Checkout
uses: actions/checkout@latest
- name: Install musl-tools on Linux
run: sudo apt-get update --yes && sudo apt-get install --yes musl-tools
if: contains(matrix.os, 'ubuntu')
- name: Build binary
shell: bash
run: |
rustup target add ${{ matrix.target }}
cargo build --release --target ${{ matrix.target }}
if: ${{ !contains(matrix.os, 'windows') }}
- name: Strip binary
shell: bash
run: |
strip target/${{ matrix.target }}/release/${{ matrix.bin }}
- name: Package as archive
shell: bash
run: |
cd target/${{ matrix.target }}/release
tar czvf ../../../${{ matrix.name }} ${{ matrix.bin }}
cd -
- name: Publish release artifacts
uses: actions/upload-artifact@v3
with:
name: rsvenv-${{ matrix.target }}
path: "rsvenv*"
if: github.ref == 'refs/tags/test-release'
- name: Publish GitHub release
uses: softprops/action-gh-release@v1
with:
draft: true
files: "rsvenv*"
body_path: Changes.md
if: startsWith( github.ref, 'refs/tags/v' )