ci: improve binary release workflow #1
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: binary-release | |
on: | |
push: | |
branches: | |
- dev | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
compile: | |
name: Compile | |
permissions: | |
contents: write | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
package: ["tuic-client", "tuic-server"] | |
toolchain: ["nightly-2024-03-01"] | |
include: | |
# Linux | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
release-name: x86_64-linux | |
cross: true | |
file-ext: "" | |
extra-args: "" | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-musl | |
release-name: x86_64-linux-musl | |
cross: true | |
file-ext: "" | |
extra-args: "" | |
- os: ubuntu-latest | |
target: i686-unknown-linux-gnu | |
release-name: i686-linux | |
cross: true | |
file-ext: "" | |
extra-args: "" | |
- os: ubuntu-latest | |
target: i686-unknown-linux-musl | |
release-name: i686-linux-musl | |
cross: true | |
file-ext: "" | |
extra-args: "" | |
# Linux arm | |
- os: ubuntu-latest | |
target: aarch64-unknown-linux-gnu | |
release-name: aarch64-linux | |
cross: true | |
file-ext: "" | |
extra-args: "" | |
- os: ubuntu-latest | |
target: aarch64-unknown-linux-musl | |
release-name: aarch64-linux-musl | |
cross: true | |
file-ext: "" | |
extra-args: "" | |
- os: ubuntu-latest | |
target: armv7-unknown-linux-gnueabi | |
release-name: armv7-linux | |
cross: true | |
file-ext: "" | |
extra-args: "" | |
- os: ubuntu-latest | |
target: armv7-unknown-linux-gnueabihf | |
release-name: armv7-linux-hf | |
cross: true | |
file-ext: "" | |
extra-args: "" | |
- os: ubuntu-latest | |
target: armv7-unknown-linux-musleabi | |
release-name: armv7-linux-musl | |
cross: true | |
file-ext: "" | |
extra-args: "" | |
- os: ubuntu-latest | |
target: armv7-unknown-linux-musleabihf | |
release-name: armv7-linux-muslhf | |
cross: true | |
file-ext: "" | |
extra-args: "" | |
# Windows | |
- os: windows-latest | |
target: x86_64-pc-windows-msvc | |
release-name: x86_64-windows | |
cross: false | |
file-ext: ".exe" | |
extra-args: "" | |
- os: windows-latest | |
target: i686-pc-windows-msvc | |
release-name: i686-windows | |
cross: true | |
file-ext: ".exe" | |
extra-args: "" | |
- os: ubuntu-latest | |
target: x86_64-pc-windows-gnu | |
release-name: x86_64-windows-gnu | |
cross: true | |
file-ext: ".exe" | |
extra-args: "" | |
# MacOSX | |
- os: macos-latest | |
target: x86_64-apple-darwin | |
release-name: x86_64-darwin | |
cross: false | |
file-ext: "" | |
extra-args: "" | |
- os: macos-latest | |
target: aarch64-apple-darwin | |
release-name: aarch64-darwin | |
cross: true | |
file-ext: "" | |
extra-args: "" | |
# FreeBSD | |
- os: ubuntu-latest | |
target: x86_64-unknown-freebsd | |
release-name: x86_64-freebsd | |
cross: true | |
file-ext: "" | |
extra-args: "" | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
- uses: actions/cache@v2 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
key: ${{ matrix.target }}-release-${{ hashFiles('**/Cargo.toml') }} | |
restore-keys: | | |
${{ matrix.target }}-release | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ matrix.toolchain }} | |
target: ${{ matrix.target }} | |
- uses: actions-rs/cargo@v1 | |
with: | |
use-cross: ${{ matrix.cross }} | |
command: build | |
args: --release -p ${{ matrix.package }} --target ${{ matrix.target }} ${{ matrix.extra-args }} | |
- name: Rename binary | |
run: mv target/${{ matrix.target }}/release/${{ matrix.package }}${{ matrix.file-ext }} ${{ matrix.package }}-${{ matrix.release-name }}${{ matrix.file-ext }} | |
- name: Upload binaries | |
uses: actions/upload-artifact@v2 | |
with: | |
name: compile | |
path: ${{ matrix.package }}-${{ matrix.release_name }}${{ matrix.file-ext }} | |
release: | |
name: Release | |
needs: [compile] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
- name: Download binaries | |
uses: actions/download-artifact@v2 | |
with: | |
name: compile | |
path: ./packages | |
- name: Github release | |
uses: "marvinpinto/action-automatic-releases@latest" | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
automatic_release_tag: latest | |
prerelease: true | |
title: "Bleeding edge/前沿版本" | |
files: | | |
packages/* | |
LICENSE |