Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
juzi5201314 committed Jan 16, 2022
2 parents 889236a + 57deac5 commit a7f4201
Showing 1 changed file with 70 additions and 0 deletions.
70 changes: 70 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Release

on:
push:
tags:
- '*'
workflow_dispatch:

env:
CARGO_TERM_COLOR: always

jobs:
release:
name: Cross build for ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
bin: clairvoyance

- os: macos-latest
target: x86_64-apple-darwin
bin: clairvoyance

- os: windows-latest
target: x86_64-pc-windows-msvc
bin: clairvoyance.exe
steps:
- name: install musl
if: matrix.os == 'ubuntu-latest'
run: sudo apt install musl-tools

- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
target: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v1
with:
key: ${{ matrix.target }}
- name: Build release
run: cargo +nightly build --release --target ${{ matrix.target }}
- name: Run UPX
continue-on-error: true
if: matrix.os == 'ubuntu-latest' || matrix.os == 'windows-latest'
uses: crazy-max/ghaction-upx@v1
with:
version: v3.96
files: target/${{ matrix.target }}/release/${{ matrix.bin }}
args: -q --best --lzma
- uses: actions/upload-artifact@v2
with:
name: clairvoyance-${{ matrix.target }}
path: target/${{ matrix.target }}/release/${{ matrix.bin }}
- name: Zip Release
uses: TheDoctor0/[email protected]
with:
type: zip
filename: clairvoyance-${{ matrix.target }}.zip
directory: target/${{ matrix.target }}/release/
path: ${{ matrix.bin }}
- name: Publish
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: target/${{ matrix.target }}/release/clairvoyance-${{ matrix.target }}.zip
generate_release_notes: true
draft: true

0 comments on commit a7f4201

Please sign in to comment.