mmtc/.github/workflows/release.yml

152 lines
4.3 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 }}
2021-02-05 15:54:50 +00:00
env:
RUSTFLAGS: -Z strip=symbols
2020-11-03 00:01:46 +00:00
- 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
2021-02-17 21:27:13 +00:00
completions:
name: completions
needs: create_release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
- name: Cargo build
uses: actions-rs/cargo@v1
with:
command: build
- name: Find generated completions
run: |
outputs=(target/debug/build/mmtc-*/out/completions)
cp -r "${outputs[0]}" completions
- name: Upload bash completion
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ./completions/mmtc.bash
asset_name: mmtc.bash
asset_content_type: text/plain
- name: Upload elvish completion
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ./completions/mmtc.elv
asset_name: mmtc.elv
asset_content_type: text/plain
- name: Upload fish completion
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ./completions/mmtc.fish
asset_name: mmtc.fish
asset_content_type: text/plain
- name: Upload powershell completion
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ./completions/_mmtc.ps1
asset_name: mmtc.ps1
asset_content_type: text/plain
- name: Upload zsh completion
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ./completions/_mmtc
asset_name: mmtc.zsh
asset_content_type: text/plain