aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/release.yml
blob: 7a432c4aeceb76f58592b34d93647baf320eb5e6 (plain)
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: Release

on:
  workflow_dispatch:
  push:
    tags:
      - "v*"

permissions:
  contents: write

jobs:
  build:
    strategy:
      fail-fast: false
      matrix:
        include:
          - os: ubuntu-latest
            artifact_name: pomoru
            asset_name: pomoru-${{ github.ref_name }}-linux-x86_64

          - os: windows-latest
            artifact_name: pomoru.exe
            asset_name: pomoru-${{ github.ref_name }}-windows-x86_64.exe

          - os: macos-latest
            artifact_name: pomoru
            asset_name: pomoru-${{ github.ref_name }}-macos-aarch64

    runs-on: ${{ matrix.os }}

    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable

      - name: Build
        run: cargo build --release

      - name: Rename binary
        shell: bash
        run: |
          mkdir dist

          if [[ "${{ runner.os }}" == "Windows" ]]; then
            cp target/release/${{ matrix.artifact_name }} dist/${{ matrix.asset_name }}
          else
            cp target/release/${{ matrix.artifact_name }} dist/${{ matrix.asset_name }}
          fi

      - name: Upload Release Asset
        uses: softprops/action-gh-release@v2
        with:
          files: dist/*