summaryrefslogtreecommitdiffstats
path: root/.github/workflows/release.yml
blob: 0ee750f34f204ee8cc2b452bc0d0330e5c6e5b9d (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
name: Release
on:
  push:
    tags:
      - v*
    branches:
      - v*
jobs:
  release:
    strategy:
      matrix:
        platform:
          - os: ubuntu-latest
            target: x86_64-unknown-linux-gnu
            bin: viewercount
            name: viewercount-${{ github.ref_name }}-linux-x86_64
          - os: ubuntu-latest
            target: aarch64-unknown-linux-gnu
            bin: viewercount
            name: viewercount-${{ github.ref_name }}-linux-aarch64
    runs-on: ${{ matrix.platform.os }}
    steps:
    - uses: actions/checkout@v4
    - uses: Swatinem/rust-cache@v2
    - name: Build binary
      uses: houseabsolute/actions-rust-cross@v0
      with:
        target: ${{ matrix.platform.target }}
        args: "--locked --release"
        strip: true
    - name: Package
      shell: bash
      run: |
        mkdir ${{ matrix.platform.name }}
        cp target/${{ matrix.platform.target }}/release/${{ matrix.platform.bin }} ${{ matrix.platform.name }}
        cp LICENSE.txt ${{ matrix.platform.name }}
        cp README.md ${{ matrix.platform.name }}
        tar czvf ${{ matrix.platform.name }}.tar.gz ${{ matrix.platform.name }}
    - name: Generate Changelog
      run: utils/generate_changelog.sh > ${{ github.workspace }}-CHANGELOG.md
    - name: Publish
      uses: softprops/action-gh-release@v2
      if: startsWith(github.ref, 'refs/tags/')
      with:
          body_path: ${{ github.workspace }}-CHANGELOG.md
          fail_on_unmatched_files: true
          files: viewercount-*
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}