summaryrefslogtreecommitdiff
path: root/.github/workflows/release.yml
blob: 407b453512d6009514c8a2135bb2d454f17c1a3c (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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
name: Release Build
on:
  release:
    types: [created]

permissions:
  contents: write
  packages: write

jobs:
  build-linux:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-go@v5
        with:
          go-version: '1.21'
      - name: Install Fyne
        run: go install fyne.io/tools/cmd/fyne@latest
      - name: Install Linux deps
        run: sudo apt-get update && sudo apt-get install -y libgl1-mesa-dev xorg-dev
      - name: Package for Linux
        run: fyne package -os linux
      - name: Upload to release
        uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          upload_url: ${{ github.event.release.upload_url }}
          asset_path: ./Shiv.tar.xz
          asset_name: Shiv-linux.tar.xz
          asset_content_type: application/x-xz

  build-windows:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-go@v5
        with:
          go-version: '1.21'
      - name: Install MinGW
        run: sudo apt-get update && sudo apt-get install -y gcc-mingw-w64-x86-64
      - name: Install Fyne
        run: go install fyne.io/tools/cmd/fyne@latest
      - name: Package for Windows
        run: |
          export CC=x86_64-w64-mingw32-gcc
          fyne package -os windows
      - uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          upload_url: ${{ github.event.release.upload_url }}
          asset_path: ./Shiv.exe
          asset_name: Shiv-windows.exe
          asset_content_type: application/vnd.microsoft.portable-executable

  build-macos:
    runs-on: macos-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-go@v5
        with:
          go-version: '1.21'
      - name: Install Fyne
        run: go install fyne.io/tools/cmd/fyne@latest

      - name: Package for macOS arm64
        run: GOARCH=arm64 fyne package -os darwin

      - name: Move arm64 binary
        run: mv Shiv.app/Contents/MacOS/Shiv Shiv.app/Contents/MacOS/Shiv-arm64

      - name: Package for macOS amd64
        run: GOARCH=amd64 fyne package -os darwin

      - name: Move amd64 binary
        run: mv Shiv.app/Contents/MacOS/Shiv Shiv.app/Contents/MacOS/Shiv-amd64

      - name: Create universal binary with lipo
        run: |
          lipo -create \
            Shiv.app/Contents/MacOS/Shiv-arm64 \
            Shiv.app/Contents/MacOS/Shiv-amd64 \
            -output Shiv.app/Contents/MacOS/Shiv
          rm Shiv.app/Contents/MacOS/Shiv-arm64 Shiv.app/Contents/MacOS/Shiv-amd64

      - name: Zip the app
        run: zip -r Shiv-macos.zip Shiv.app

      - name: Upload to release
        uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          upload_url: ${{ github.event.release.upload_url }}
          asset_path: ./Shiv-macos.zip
          asset_name: Shiv-macos.zip
          asset_content_type: application/zip