aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/release.yml
blob: 2be7084e06f5aedb48a3f8fc446c19b697d91217 (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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: Release binaries

on:
  push:
    tags:
      - 'v*'

permissions:
  contents: write
  packages: write

jobs:
  linux-x86_64:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Install deps
        run: |
          sudo apt-get update
          sudo apt-get install -y \
            build-essential \
            libgmp-dev \
            libunistring-dev \
            libgc-dev \
            xxd \
            binutils

      - name: Build
        run: |
          make clean
          make -j

      - name: Package
        run: |
          TAG=${GITHUB_REF#refs/tags/}
          tar -C build -czf tomo-linux-x86_64.tar.gz tomo@${TAG}
          sha256sum tomo-linux-x86_64.tar.gz > tomo-linux-x86_64.tar.gz.sha256

      - name: Upload
        uses: softprops/action-gh-release@v2
        with:
          files: |
            tomo-linux-x86_64.tar.gz
            tomo-linux-x86_64.tar.gz.sha256

  linux-aarch64:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Install deps
        run: |
          sudo apt-get update
          sudo apt-get install -y \
            build-essential \
            libgmp-dev \
            libunistring-dev \
            libgc-dev \
            xxd \
            binutils

      - name: Build
        run: |
          make clean
          make -j

      - name: Package
        run: |
          TAG=${GITHUB_REF#refs/tags/}
          tar -C build -czf tomo-linux-aarch64.tar.gz tomo@${TAG}
          sha256sum tomo-linux-aarch64.tar.gz > tomo-linux-aarch64.tar.gz.sha256

      - name: Upload
        uses: softprops/action-gh-release@v2
        with:
          files: |
            tomo-linux-aarch64.tar.gz
            tomo-linux-aarch64.tar.gz.sha256

  macos:
    runs-on: macos-latest
    steps:
      - uses: actions/checkout@v4

      - name: Install deps
        run: |
          brew update
          brew install gmp libunistring bdw-gc llvm binutils

      - name: Build arm64
        run: |
          make clean
          make -j \
            CC=clang \
            CFLAGS="-arch arm64" \
            LDFLAGS="-arch arm64"
          mv build/tomo build/tomo-arm64

      - name: Build x86_64
        run: |
          make clean
          make -j \
            CC=clang \
            CFLAGS="-arch x86_64" \
            LDFLAGS="-arch x86_64"
          mv build/tomo build/tomo-x86_64

      - name: Create universal binary
        run: |
          lipo -create \
            build/tomo-arm64 \
            build/tomo-x86_64 \
            -output build/tomo
          lipo -info build/tomo

      - name: Package
        run: |
          TAG=${GITHUB_REF#refs/tags/}
          tar -C build -czf tomo-macos-universal.tar.gz tomo@${TAG}
          shasum -a 256 tomo-macos-universal.tar.gz > tomo-macos-universal.tar.gz.sha256

      - name: Upload
        uses: softprops/action-gh-release@v2
        with:
          files: |
            tomo-macos-universal.tar.gz
            tomo-macos-universal.tar.gz.sha256