Skip to content

Commit

Permalink
ci: improve release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Itsusinn committed Jul 13, 2022
1 parent 776661e commit c1fb74f
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 48 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
86 changes: 40 additions & 46 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:

env:
SHORT_NAME: tg
CRATE_NAME: telegram-message-source

jobs:
compile:
Expand All @@ -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:
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit c1fb74f

Please sign in to comment.