aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/build-release.yaml
blob: fb1abd37f7f8c318a855a75e192b0425f5571871 (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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: Build and Release ssh-bip39gen

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

permissions:
  contents: write

jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        include:
          - platform: linux-amd64
            goos: linux
            goarch: amd64
          - platform: linux-386
            goos: linux
            goarch: 386
          - platform: windows-amd64
            goos: windows
            goarch: amd64
          - platform: windows-386
            goos: windows
            goarch: 386
          - platform: darwin-amd64
            goos: darwin
            goarch: amd64
          - platform: darwin-arm64
            goos: darwin
            goarch: arm64

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

      - name: Set up Go
        uses: actions/setup-go@v5
        with:
          go-version: "1.21"

      - name: Install dependencies
        run: go mod tidy

      - name: Build ${{ matrix.platform }}
        env:
          GOOS: ${{ matrix.goos }}
          GOARCH: ${{ matrix.goarch }}
        run: |
          make ${{ matrix.platform }}
          ls -lh build/

      - name: Upload artifact
        uses: actions/upload-artifact@v4
        with:
          name: ssh-bip39gen-${{ matrix.platform }}
          path: build/ssh-bip39gen-${{ matrix.platform }}*

  release:
    needs: build
    runs-on: ubuntu-latest
    steps:
      - name: Download all artifacts
        uses: actions/download-artifact@v4
        with:
          path: artifacts

      - name: Create Release
        uses: softprops/action-gh-release@v2
        with:
          files: |
            artifacts/ssh-bip39gen-linux-amd64/ssh-bip39gen-linux-amd64
            artifacts/ssh-bip39gen-linux-386/ssh-bip39gen-linux-386
            artifacts/ssh-bip39gen-windows-amd64/ssh-bip39gen-windows-amd64.exe
            artifacts/ssh-bip39gen-windows-386/ssh-bip39gen-windows-386.exe
            artifacts/ssh-bip39gen-darwin-amd64/ssh-bip39gen-darwin-amd64
            artifacts/ssh-bip39gen-darwin-arm64/ssh-bip39gen-darwin-arm64
          draft: false
          prerelease: false
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}