aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/publish.yml
blob: b876405ac0251931c5da98f72d0e06b963c20ceb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: Publish release
on:
  push:
    tags:
      - '*'

jobs:
  build:
    name: Publish
    runs-on: ${{ matrix.config.os }}
    strategy:
      matrix:
        config:
          - {
            os: ubuntu-latest,
            artifact_name: t,
            asset_name: t-linux-amd64,
            strip: true
            }
          - {
            os: windows-latest,
            artifact_name: t.exe,
            asset_name: t-windows-amd64,
            strip: false
            }
          - {
            os: macos-latest,
            artifact_name: t,
            asset_name: t-macos-amd64,
            strip: true
            }
    steps:
      - uses: hecrj/setup-rust-action@v1
        with:
          rust-version: stable
      - uses: actions/checkout@v2
      - name: Build
        run: cargo build --release
      - name: Compress binaries
        uses: svenstaro/upx-action@v1-release
        with:
          file: target/release/${{ matrix.config.artifact_name }}
          args: '-9'
          strip: ${{ matrix.config.strip }}
      - name: Install macOS dependencies
        if: matrix.config.os == 'macos-latest'
        run: brew install p7zip
      - name: Zip binary file
        run: 7z a ./${{ matrix.config.asset_name }}.zip ./target/release/${{ matrix.config.artifact_name }}
      - name: Upload binaries to release
        uses: svenstaro/upload-release-action@v1-release
        with:
          repo_token: ${{ secrets.TOKEN }}
          file: ./${{ matrix.config.asset_name }}.zip
          asset_name: ${{ matrix.config.asset_name }}.zip
          tag: ${{ github.ref }}