chore: Release unison-fsmonitor version 0.3.8 #24
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: Build, test and release | |
on: [push, pull_request] | |
jobs: | |
create-release: | |
if: startsWith(github.ref, 'refs/tags/v') | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Create release" | |
uses: actions/create-release@v1 | |
id: create_release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref }} | |
draft: false | |
prerelease: false | |
outputs: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
build-test-and-release: | |
needs: create-release | |
if: ${{ always() }} | |
strategy: | |
fail-fast: false | |
matrix: | |
job: | |
- { target: x86_64-apple-darwin, exe: macos-amd64, os: macos-latest, test: true } | |
- { target: aarch64-apple-darwin, exe: macos-aarch64, os: macos-latest, test: false } # run aarch64 binary is not supported | |
# Linux already has a native binary: https://github.com/Homebrew/homebrew-core/pull/115779 | |
# - { target: x86_64-unknown-linux-gnu, exe: linux-amd64, os: ubuntu-latest, test: true } | |
# - { target: aarch64-unknown-linux-gnu, exe: linux-aarch64, os: ubuntu-latest, test: true } | |
runs-on: ${{ matrix.job.os }} | |
steps: | |
- name: "Checkout the code" | |
uses: actions/checkout@v2 | |
- name: "Setup Rust toolchain" | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
target: ${{ matrix.job.target }} | |
components: rust-src # necessary for wasi, because there isn't a cross image for it | |
- name: "Build the package" | |
uses: actions-rs/cargo@v1 | |
with: | |
use-cross: true | |
args: --verbose --target=${{ matrix.job.target }} --locked | |
command: build | |
- name: "Run tests" | |
uses: actions-rs/cargo@v1 | |
if: ${{ matrix.job.test == true }} | |
with: | |
use-cross: true | |
args: --verbose --target=${{ matrix.job.target }} --locked | |
command: test | |
- name: "Build release binary" | |
if: startsWith(github.ref, 'refs/tags/v') | |
uses: actions-rs/cargo@v1 | |
with: | |
use-cross: true | |
args: --verbose --release --target=${{ matrix.job.target }} --locked | |
command: build | |
- name: "Prepare the artifacts" | |
if: startsWith(github.ref, 'refs/tags/v') | |
run: cd target/${{ matrix.job.target }}/release && tar -cvf unison-fsmonitor-${{ matrix.job.exe }}.tar.gz unison-fsmonitor | |
- name: "Upload the artifacts" | |
uses: actions/upload-release-asset@v1 | |
if: startsWith(github.ref, 'refs/tags/v') | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.create-release.outputs.upload_url }} | |
asset_path: ./target/${{ matrix.job.target }}/release/unison-fsmonitor-${{ matrix.job.exe }}.tar.gz | |
asset_name: unison-fsmonitor-${{ matrix.job.exe }}.tar.gz | |
asset_content_type: application/gzip |