Skip to content

Update README.md

Update README.md #18

Workflow file for this run

name: pre-release
on:
push:
branches:
- dev
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
PACKAGE: "tuic-server"
PACKAGE2: "tuic-client"
jobs:
compile:
name: Compile
permissions:
contents: write
runs-on: ${{ matrix.os }}
strategy:
matrix:
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: ""
# Windows GNU
# - 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@v4
with:
submodules: true
- uses: actions/cache@v4
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: nightly
target: ${{ matrix.target }}
# Build client and server separately
# But i gotta say that's ugly
# Blame me that can't figure out how GHA matrix works
- uses: clechasseur/rs-cargo@v2
with:
use-cross: ${{ matrix.cross }}
command: build
args: --release -p ${{ env.PACKAGE }} --target ${{ matrix.target }} ${{ matrix.extra-args }}
- name: Rename binary
run: mv target/${{ matrix.target }}/release/${{ env.PACKAGE }}${{ matrix.file-ext }} ${{ env.PACKAGE }}-${{ matrix.release-name }}${{ matrix.file-ext }}
- name: Upload binaries
uses: actions/upload-artifact@v4
with:
name: binary-${{ matrix.target }}-${{ env.PACKAGE }}
path: ${{ env.PACKAGE }}-${{ matrix.release-name }}${{ matrix.file-ext }}
- uses: clechasseur/rs-cargo@v2
with:
use-cross: ${{ matrix.cross }}
command: build
args: --release -p ${{ env.PACKAGE2 }} --target ${{ matrix.target }} ${{ matrix.extra-args }}
- name: Rename binary
run: mv target/${{ matrix.target }}/release/${{ env.PACKAGE2 }}${{ matrix.file-ext }} ${{ env.PACKAGE2 }}-${{ matrix.release-name }}${{ matrix.file-ext }}
- name: Upload binaries
uses: actions/upload-artifact@v4
with:
name: binary-${{ matrix.target }}-${{ env.PACKAGE2 }}
path: ${{ env.PACKAGE2 }}-${{ matrix.release-name }}${{ matrix.file-ext }}
release:
name: Release
needs: [compile]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Merge binaries
uses: actions/upload-artifact/merge@v4
with:
name: binaries
pattern: binary-*
- name: Download binaries
uses: actions/download-artifact@v4
with:
name: binaries
path: ./packages
- name: Github release
uses: "mathieucarbou/marvinpinto-action-automatic-releases@master"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: latest
prerelease: true
title: "Bleeding edge/前沿版本"
files: |
packages/*
LICENSE
docker:
name: Docker
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Lowercase docker tag
id: get-ownername
run: |
echo "OWNER=${GITHUB_REPOSITORY_OWNER@L}" >> "$GITHUB_OUTPUT"
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: .github/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ghcr.io/${{ steps.get-ownername.outputs.OWNER }}/tuic-server:latest
- name: Delete all images from package without tags
uses: pcasteran/ghcr-cleaning-action@v1
with:
user: ${{ steps.get-ownername.outputs.OWNER }}
package: tuic-server
password: ${{ secrets.SECRET_PAT }}