mmtc/.github/workflows/release.yml

74 lines
2 KiB
YAML
Raw Normal View History

2020-11-03 00:01:46 +00:00
name: release
on:
push:
tags:
- v[0-9]+.[0-9]+.[0-9]+
jobs:
create_release:
name: create_release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
tag_name: ${{ github.ref }}
release_name: mmtc ${{ github.ref }}
body: "[Changelog](https://github.com/figsoda/mmtc/blob/main/CHANGELOG.md)"
draft: false
prerelease: false
release:
name: release
needs: create_release
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- target: x86_64-apple-darwin
os: macos-latest
- target: x86_64-pc-windows-gnu
os: windows-latest
ext: .exe
- target: x86_64-pc-windows-msvc
os: windows-latest
ext: .exe
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
target: ${{ matrix.target }}
override: true
- name: Cargo build
uses: actions-rs/cargo@v1
with:
command: build
args: --release --target ${{ matrix.target }}
- name: Upload release asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ./target/${{ matrix.target }}/release/mmtc${{ matrix.ext }}
asset_name: mmtc-${{ matrix.target }}${{ matrix.ext }}
asset_content_type: application/octet-stream