-
Notifications
You must be signed in to change notification settings - Fork 0
141 lines (123 loc) · 4.33 KB
/
Copy pathrelease.yml
File metadata and controls
141 lines (123 loc) · 4.33 KB
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
130
131
132
133
134
135
136
137
138
139
140
141
name: Release
on:
workflow_dispatch:
permissions:
contents: write
pull-requests: read
jobs:
# macOS runner: builds the darwin (clang/cgo) and windows (pure Go) artifacts,
# creates the GitHub Release, and publishes the Homebrew cask.
goreleaser:
runs-on: macos-latest
outputs:
new_tag: ${{ steps.tag.outputs.new_tag }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.26.4"
- name: Bump version and push tag
id: tag
uses: mathieudutour/github-tag-action@v6.2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Fetch tags
run: git fetch --tags
- name: Get macOS SDK path
id: sdk
run: echo "path=$(xcrun --show-sdk-path)" >> "$GITHUB_OUTPUT"
# Generate the Windows icon/version resources so GoReleaser's windows
# builds embed the jify icon. These are build artifacts, not committed.
- name: Generate Windows resources
if: steps.tag.outputs.new_tag
run: |
go run github.com/josephspurrier/goversioninfo/cmd/goversioninfo@v1.7.0 -64 -o resource_windows_amd64.syso versioninfo.json
go run github.com/josephspurrier/goversioninfo/cmd/goversioninfo@v1.7.0 -64 -arm -o resource_windows_arm64.syso versioninfo.json
- name: Run GoReleaser
if: steps.tag.outputs.new_tag
uses: goreleaser/goreleaser-action@v6
with:
version: latest
args: release --clean
env:
SDK_PATH: ${{ steps.sdk.outputs.path }}
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
BOT_GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
# Ubuntu runners: native cgo Linux builds (GTK3 + X11), attached to the same
# release as tarballs.
linux-tarballs:
needs: goreleaser
if: needs.goreleaser.outputs.new_tag
runs-on: ${{ matrix.runner }}
permissions:
contents: write
strategy:
matrix:
include:
- arch: amd64
runner: ubuntu-latest
- arch: arm64
runner: ubuntu-24.04-arm
steps:
- name: Checkout release tag
uses: actions/checkout@v4
with:
ref: ${{ needs.goreleaser.outputs.new_tag }}
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.26.4"
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libx11-dev libxtst-dev pkg-config
- name: Build
env:
CGO_ENABLED: "1"
run: |
TAG="${{ needs.goreleaser.outputs.new_tag }}"
VER="${TAG#v}"
go build -trimpath -ldflags "-s -w -X main.version=${VER} -X main.date=$(date -u +%Y-%m-%dT%H:%M:%SZ)" -o jify .
NAME="jify_${VER}_linux_${{ matrix.arch }}"
tar -czf "${NAME}.tar.gz" jify LICENSE README.md config.example.json
echo "asset=${NAME}.tar.gz" >> "$GITHUB_ENV"
- name: Upload to release
env:
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
run: gh release upload "${{ needs.goreleaser.outputs.new_tag }}" "${{ env.asset }}" --clobber
# Build and publish the Linux snap (classic confinement) to the Snap Store.
snapcraft:
needs: goreleaser
if: needs.goreleaser.outputs.new_tag
runs-on: ${{ matrix.runner }}
strategy:
matrix:
include:
- arch: amd64
runner: ubuntu-latest
- arch: arm64
runner: ubuntu-24.04-arm
steps:
- name: Checkout release tag
uses: actions/checkout@v4
with:
ref: ${{ needs.goreleaser.outputs.new_tag }}
fetch-depth: 0
- name: Install Snapcraft and LXD
run: |
sudo snap install snapcraft --classic
sudo snap install lxd
sudo lxd init --auto
sudo iptables -P FORWARD ACCEPT
sudo usermod -aG lxd "$USER"
- name: Build snap
run: sg lxd -c 'snapcraft pack --use-lxd --build-for=${{ matrix.arch }}'
- name: Publish snap
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }}
run: snapcraft upload --release=stable *.snap