Skip to content

Commit

Permalink
ci: improve binary release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Itsusinn committed Mar 23, 2024
1 parent 914f6cb commit 4d53a16
Show file tree
Hide file tree
Showing 3 changed files with 375 additions and 123 deletions.
187 changes: 187 additions & 0 deletions .github/workflows/binary-pre-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
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
Loading

0 comments on commit 4d53a16

Please sign in to comment.