From c1fb74ff7a52e85055021b0cf0f3914a514c145a Mon Sep 17 00:00:00 2001 From: Itsusinn Date: Wed, 13 Jul 2022 16:05:53 +0800 Subject: [PATCH] ci: improve release workflow --- .github/workflows/pre-release.yml | 4 +- .github/workflows/release.yml | 86 ++++++++++++++----------------- 2 files changed, 42 insertions(+), 48 deletions(-) diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml index 034cd4d..651c502 100644 --- a/.github/workflows/pre-release.yml +++ b/.github/workflows/pre-release.yml @@ -32,8 +32,8 @@ jobs: cross: true - os: ubuntu-latest - target: aarch64-unknown-linux-gnu - release_name: aarch64-linux-gnu + target: aarch64-unknown-linux-musl + release_name: aarch64-linux-musl postfix: "" extra_args: "" cross: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cd00631..ff28c43 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,6 +7,7 @@ on: env: SHORT_NAME: tg + CRATE_NAME: telegram-message-source jobs: compile: @@ -15,60 +16,61 @@ jobs: strategy: matrix: include: + # Linux - os: ubuntu-latest - file: ./target/x86_64-unknown-linux-musl/release/${{ github.event.repository.name }} target: x86_64-unknown-linux-musl - extra_args: - release_name: linux-x86_64 + release_name: x86_64-linux-musl + postfix: "" + extra_args: "" cross: true - os: ubuntu-latest - file: ./target/i686-unknown-linux-musl/release/${{ github.event.repository.name }} target: i686-unknown-linux-musl - extra_args: - release_name: linux-i686 + release_name: i686-linux-musl + postfix: "" + extra_args: "" cross: true - os: ubuntu-latest - file: ./target/aarch64-unknown-linux-gnu/release/${{ github.event.repository.name }} - target: aarch64-unknown-linux-gnu - extra_args: - release_name: linux-aarch64 + target: aarch64-unknown-linux-musl + release_name: aarch64-linux-musl + postfix: "" + extra_args: "" cross: true - - - os: windows-latest - file: ./target/x86_64-pc-windows-msvc/release/${{ github.event.repository.name }}.exe - target: x86_64-pc-windows-msvc + # Windows GNU + - os: ubuntu-latest + target: x86_64-pc-windows-gnu + release_name: x86_64-windows-gnu.exe + postfix: ".exe" extra_args: --no-default-features --features no-color - release_name: windows-x86_64.exe - cross: false + cross: true - - os: windows-latest - file: ./target/i686-pc-windows-msvc/release/${{ github.event.repository.name }}.exe - target: i686-pc-windows-msvc + - os: ubuntu-latest + target: i686-pc-windows-gnu + release_name: i686-windows-gnu.exe + postfix: ".exe" extra_args: --no-default-features --features no-color - release_name: windows-i686.exe - cross: false - - - os: windows-latest - file: ./target/x86_64-pc-windows-msvc/release/${{ github.event.repository.name }}.exe - target: x86_64-pc-windows-msvc - extra_args: - release_name: windows-x86_64-colored.exe - cross: false + cross: true - - os: windows-latest - file: ./target/i686-pc-windows-msvc/release/${{ github.event.repository.name }}.exe - target: i686-pc-windows-msvc - extra_args: - release_name: windows-i686-colored.exe - cross: false + - os: ubuntu-latest + target: x86_64-pc-windows-gnu + release_name: x86_64-windows-gnu-colored.exe + postfix: ".exe" + extra_args: "" + cross: true + - os: ubuntu-latest + target: i686-pc-windows-gnu + release_name: i686-windows-gnu-colored.exe + postfix: ".exe" + extra_args: "" + cross: true + # Mac OSX - os: macos-latest - file: ./target/x86_64-apple-darwin/release/${{ github.event.repository.name }} target: x86_64-apple-darwin - extra_args: - release_name: mac-x86_64 + release_name: x86_64-mac + postfix: "" + extra_args: "" cross: false steps: @@ -98,16 +100,8 @@ jobs: command: build args: --release --target ${{ matrix.target }} ${{ matrix.extra_args }} - - name: UPX Compress - if: matrix.os == 'windows-latest' - uses: svenstaro/upx-action@v2 - with: - file: ${{ matrix.file }} - strip: false - args: --best --lzma - - name: Rename binary - run: mv ${{ matrix.file }} ${{ env.SHORT_NAME }}-${{ matrix.release_name }} + run: mv target/${{ matrix.target }}/release/${{ env.CRATE_NAME }}${{ matrix.postfix }} ${{ env.SHORT_NAME }}-${{ matrix.release_name }} - name: Upload binaries uses: actions/upload-artifact@v2