Skip to content

Commit c7813ed

Browse files
committed
Add GitHub Actions cross-platform build workflow
1 parent 98859c7 commit c7813ed

2 files changed

Lines changed: 72 additions & 0 deletions

File tree

.github/workflows/build.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- "v*"
9+
pull_request:
10+
workflow_dispatch:
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
build:
17+
name: Build ${{ matrix.goos }}-${{ matrix.goarch }}
18+
runs-on: ubuntu-latest
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
include:
23+
- goos: linux
24+
goarch: amd64
25+
- goos: linux
26+
goarch: arm64
27+
- goos: darwin
28+
goarch: amd64
29+
- goos: darwin
30+
goarch: arm64
31+
- goos: windows
32+
goarch: amd64
33+
steps:
34+
- name: Checkout
35+
uses: actions/checkout@v4
36+
37+
- name: Setup Go
38+
uses: actions/setup-go@v5
39+
with:
40+
go-version-file: go.mod
41+
42+
- name: Build binary
43+
shell: bash
44+
run: |
45+
set -euo pipefail
46+
mkdir -p dist
47+
48+
ext=""
49+
if [[ "${{ matrix.goos }}" == "windows" ]]; then
50+
ext=".exe"
51+
fi
52+
53+
out="ticktick-${{ matrix.goos }}-${{ matrix.goarch }}${ext}"
54+
GOOS="${{ matrix.goos }}" GOARCH="${{ matrix.goarch }}" CGO_ENABLED=0 \
55+
go build -trimpath -ldflags="-s -w" -o "dist/${out}" ./cmd/ticktick
56+
57+
(cd dist && sha256sum "${out}" > "${out}.sha256")
58+
59+
- name: Upload artifact
60+
uses: actions/upload-artifact@v4
61+
with:
62+
name: ticktick-${{ matrix.goos }}-${{ matrix.goarch }}
63+
path: |
64+
dist/ticktick-${{ matrix.goos }}-${{ matrix.goarch }}*

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@ or
3232
sudo install -m 0755 ./ticktick /usr/local/bin/ticktick
3333
```
3434

35+
## CI Builds
36+
37+
GitHub Actions builds binaries automatically on every push to `main`, tags (`v*`), pull requests, and manual dispatch.
38+
39+
- Open the repository's **Actions** tab.
40+
- Select the latest **Build** workflow run.
41+
- Download the artifact matching your platform (for example `ticktick-linux-amd64`).
42+
3543
## OAuth setup
3644

3745
Create a TickTick app and get:

0 commit comments

Comments
 (0)