code / tomo

Lines41.3K C23.7K Markdown9.7K YAML5.0K Tomo2.3K
7 others 763
Python231 Shell230 make212 INI47 Text21 SVG16 Lua6
(151 lines)
1 name: Release binaries
3 on:
4 push:
5 tags:
6 - 'v*'
8 permissions:
9 contents: write
11 jobs:
12 build-linux:
13 strategy:
14 matrix:
15 arch:
16 - x86_64
17 - aarch64
19 include:
20 - arch: x86_64
21 runner: ubuntu-latest
22 - arch: aarch64
23 runner: ubuntu-24.04-arm64
25 runs-on: ${{ matrix.runner }}
27 steps:
28 - uses: actions/checkout@v4
30 - name: Install deps
31 run: |
32 sudo apt-get update
33 sudo apt-get install -y build-essential libgmp-dev libunistring-dev libgc-dev binutils
35 - name: Build
36 run: |
37 make -j
39 - name: Package
40 run: |
41 TAG=${GITHUB_REF_NAME}
42 FILE=tomo-linux-${{ matrix.arch }}.tar.gz
43 tar -C build -czf "$FILE" tomo@${TAG}
44 sha256sum "$FILE" > "$FILE.sha256"
46 - name: Upload artifacts
47 uses: actions/upload-artifact@v4
48 with:
49 name: linux-${{ matrix.arch }}
50 path: |
51 tomo-linux-${{ matrix.arch }}.tar.gz
52 tomo-linux-${{ matrix.arch }}.tar.gz.sha256
54 build-macos:
55 runs-on: macos-latest
56 steps:
57 - uses: actions/checkout@v4
59 - name: Install deps
60 run: |
61 brew update
62 brew install --quiet gmp libunistring bdw-gc llvm binutils
64 - name: Build arm64
65 run: |
66 make -j
68 - name: Package
69 run: |
70 TAG=${GITHUB_REF_NAME}
71 tar -C build -czf tomo-macos-arm64.tar.gz tomo@${TAG}
72 shasum -a 256 tomo-macos-arm64.tar.gz > tomo-macos-arm64.tar.gz.sha256
74 - name: Upload artifacts
75 uses: actions/upload-artifact@v4
76 with:
77 name: macos-arm64
78 path: |
79 tomo-macos-arm64.tar.gz
80 tomo-macos-arm64.tar.gz.sha256
82 upload-release:
83 needs: [build-linux, build-macos]
84 runs-on: ubuntu-latest
85 steps:
86 - uses: actions/checkout@v4
88 - name: Download all artifacts
89 uses: actions/download-artifact@v3
90 with:
91 path: release/
93 - name: List artifacts
94 run: ls -l release/
96 - name: Create GitHub Release
97 uses: softprops/action-gh-release@v2
98 with:
99 files: |
100 tomo-linux-x86_64.tar.gz
101 tomo-linux-x86_64.tar.gz.sha256
102 tomo-linux-aarch64.tar.gz
103 tomo-linux-aarch64.tar.gz.sha256
104 tomo-macos-arm64.tar.gz
105 tomo-macos-arm64.tar.gz.sha256
107 publish-aur:
108 needs: upload-release
109 runs-on: ubuntu-latest
110 env:
111 AUR_SSH_KEY: ${{ secrets.AUR_SSH_KEY }}
112 steps:
113 - uses: actions/checkout@v4
115 - name: Install deps
116 run: |
117 sudo apt-get install -y pacman-contrib jq gh
119 - name: Set up SSH
120 run: |
121 mkdir -p ~/.ssh
122 echo "$AUR_SSH_KEY" > ~/.ssh/id_ed25519
123 chmod 600 ~/.ssh/id_ed25519
124 ssh-keyscan aur.archlinux.org >> ~/.ssh/known_hosts
126 - name: Wait for release assets
127 run: |
128 TAG=${GITHUB_REF_NAME}
129 for i in $(seq 60); do
130 if gh release view "$TAG" --json assets \
131 | jq -e '[ .assets[].name ] | index("tomo-linux-x86_64.tar.gz") and index("tomo-linux-aarch64.tar.gz")' >/dev/null
132 then exit 0; fi
133 sleep 10
134 done
135 echo "Timed out waiting for release assets"
136 exit 1
138 - name: Update PKGBUILD
139 run: |
140 TAG=${GITHUB_REF_NAME#v}
141 sed -i "s/^_tomo_version=.*/_tomo_version=${TAG}/" PKGBUILD
142 updpkgsums
143 makepkg --printsrcinfo > .SRCINFO
144 git config user.name "GitHub Actions"
145 git config user.email "actions@github.com"
146 git diff --quiet || git commit -am "Release v${TAG}"
148 - name: Push to AUR
149 run: |
150 git push aur HEAD:master