-
Notifications
You must be signed in to change notification settings - Fork 0
208 lines (180 loc) · 5.91 KB
/
Copy pathrelease.yml
File metadata and controls
208 lines (180 loc) · 5.91 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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
name: Release
on:
workflow_dispatch:
inputs:
version:
description: 'Release version (e.g., 1.0.0)'
required: true
default: 'test'
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
build:
name: "Build (${{ matrix.target.os }})"
runs-on: ${{ matrix.target.host || 'ubuntu-latest' }}
env:
GO111MODULE: on
strategy:
fail-fast: false
matrix:
target:
- os: linux
ext: ""
archive: tar.gz
- os: windows
ext: .exe
archive: zip
- os: freebsd
ext: ""
archive: tar.gz
- os: darwin
ext: ""
archive: tar.gz
# Use macos-13 (Intel) for better Docker compatibility
host: macos-13
steps:
- name: Setup Go environment
uses: actions/setup-go@v5
with:
go-version: '1.24.5'
- name: Checkout code
uses: actions/checkout@v4
- name: Cache build artifacts
uses: actions/cache@v4
with:
path: |
~/go/pkg/mod
~/.cache/go-build
~/.cache/fyne-cross
key: ${{ runner.os }}-build-cache-${{ hashFiles('**/go.sum') }}
- name: Install fyne-cross
run: go install github.com/fyne-io/fyne-cross@latest
- name: Install Fyne (new tool)
run: go install fyne.io/fyne/v2/cmd/fyne@latest
- name: Install Docker (macOS)
if: runner.os == 'macOS'
uses: douglascamata/setup-docker-macos-action@v1-alpha
- name: Set version
id: version
run: |
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/v}
else
VERSION=${{ github.event.inputs.version }}
fi
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
- name: Prepare build
run: |
go mod tidy
go mod download
- name: Build with fyne-cross
run: |
fyne-cross \
${{ matrix.target.os }} \
-debug -no-cache \
-app-version ${{ steps.version.outputs.VERSION }} \
-app-id co.ispapp.psshclient \
-icon ./Icon.png \
-name psshclient${{ matrix.target.ext }} \
.
- name: Create release archive
run: |
# fyne-cross outputs to fyne-cross/dist/{os}-{arch}/ by default
BUILD_DIR="fyne-cross/dist/${{ matrix.target.os }}-*"
if [ "${{ matrix.target.archive }}" = "zip" ]; then
cd fyne-cross/dist/${{ matrix.target.os }}-*
zip -r ../../../psshclient-${{ matrix.target.os }}-${{ steps.version.outputs.VERSION }}.zip *
else
cd fyne-cross/dist/${{ matrix.target.os }}-*
tar -czf ../../../psshclient-${{ matrix.target.os }}-${{ steps.version.outputs.VERSION }}.tar.gz *
fi
ls -la *.tar.gz *.zip 2>/dev/null || true
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: psshclient-${{ matrix.target.os }}
path: psshclient-${{ matrix.target.os }}-${{ steps.version.outputs.VERSION }}.*
retention-days: 1
# Build native macOS ARM64 on macos-latest (Apple Silicon)
build-macos-arm64:
name: "Build (darwin-arm64)"
runs-on: macos-latest
env:
GO111MODULE: on
steps:
- name: Setup Go environment
uses: actions/setup-go@v5
with:
go-version: '1.24.5'
- name: Checkout code
uses: actions/checkout@v4
- name: Cache build artifacts
uses: actions/cache@v4
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-arm64-build-cache-${{ hashFiles('**/go.sum') }}
- name: Install Fyne (new tool)
run: go install fyne.io/fyne/v2/cmd/fyne@latest
- name: Set version
id: version
run: |
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/v}
else
VERSION=${{ github.event.inputs.version }}
fi
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
- name: Prepare build
run: |
go mod tidy
go mod download
- name: Build natively for ARM64
env:
CGO_ENABLED: 1
GOOS: darwin
GOARCH: arm64
run: |
mkdir -p dist
go build -ldflags "-s -w" -o dist/psshclient .
# Package from the root directory, not from dist
fyne package -os darwin -icon ./Icon.png -name psshclient \
-appVersion ${{ steps.version.outputs.VERSION }} -appID co.ispapp.psshclient \
-executable dist/psshclient
# Move the package to dist and create archive
mv psshclient.app dist/
cd dist
tar -czf psshclient-darwin-arm64-${{ steps.version.outputs.VERSION }}.tar.gz psshclient.app
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: psshclient-darwin-arm64
path: dist/psshclient-darwin-arm64-${{ steps.version.outputs.VERSION }}.tar.gz
retention-days: 1
release:
needs: [build, build-macos-arm64]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download all build artifacts
uses: actions/download-artifact@v4
with:
path: dist
- name: Prepare release assets
run: |
mkdir -p release-assets
find dist -type f \( -name "*.tar.gz" -o -name "*.zip" \) -exec cp {} release-assets/ \;
ls -la release-assets/
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: release-assets/*
draft: false
prerelease: false
generate_release_notes: true