-
Notifications
You must be signed in to change notification settings - Fork 2
168 lines (140 loc) · 4.77 KB
/
cd.yaml
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
name: Continuous Delivery
on:
push:
tags:
- 'v*'
env:
BUILD_RELEASE_OUTPUT: sr65-app
GO_VERSION: '1.20'
ZENITY_VERSION: 'v0.10.12'
jobs:
prepare_release:
name: Prepare Release
runs-on: ubuntu-latest
steps:
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v2
with:
name: ${{ github.ref_name }}
generate_release_notes: true
draft: true
build_zenity:
name: Build Zenity
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
arch: [amd64, arm64]
include:
- os: ubuntu-latest
artifact_os: linux
- os: macos-latest
artifact_os: darwin
- os: windows-latest
artifact_os: windows
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
repository: ncruces/zenity
ref: ${{ env.ZENITY_VERSION }}
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Build
shell: bash
working-directory: ./cmd/zenity
run: |
go generate ../../...
if [[ "${{ matrix.os }}" == "windows-latest" ]]; then
printf '#!/bin/sh\nexec zenity.exe --unixeol --cygpath "$@"' > zenity
fi
if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
GOARCH=${{ matrix.arch }} CGO_ENABLED=0 go build -tags dev
else
GOARCH=${{ matrix.arch }} CGO_ENABLED=0 go build -ldflags="-s -w" -trimpath
fi
mkdir -p outputs
mv zenity* outputs
- name: Upload binary
uses: actions/upload-artifact@v4
with:
name: zenity_${{ matrix.artifact_os }}_${{ matrix.arch }}
path: ./cmd/zenity/outputs
if-no-files-found: error
retention-days: 1
build_release:
name: Build Release
needs: [prepare_release,build_zenity]
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
arch: [amd64, arm64]
include:
- os: ubuntu-latest
release_tag_os: linux
ffmpeg_version: '6.0.1'
- os: macos-latest
release_tag_os: darwin
ffmpeg_version: '6.1.1'
- os: windows-latest
release_tag_os: windows
ffmpeg_version: '6.1.1'
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up FFMPEG
uses: FedericoCarboni/setup-ffmpeg@v3
id: setup-ffmpeg
with:
ffmpeg-version: ${{ matrix.ffmpeg_version }}
architecture: ${{ matrix.arch == 'amd64' && 'x64' || matrix.arch }}
github-token: ${{ github.server_url == 'https://github.com' && github.token || '' }}
if: ${{ !(matrix.os == 'windows-latest' && matrix.arch == 'arm64') && !(matrix.os == 'macos-latest' && matrix.arch == 'arm64') }}
- name: Embedding FFMPEG binary
run: cp ${{ steps.setup-ffmpeg.outputs.ffmpeg-path }}/ffmpeg* embed/bin
if: ${{ !(matrix.os == 'windows-latest' && matrix.arch == 'arm64') && !(matrix.os == 'macos-latest' && matrix.arch == 'arm64') }}
- name: Embedding Zenity binary
uses: actions/download-artifact@v4
with:
name: zenity_${{ matrix.release_tag_os }}_${{ matrix.arch }}
path: embed/bin
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Build
shell: bash
run: GOARCH=${{ matrix.arch }} go build
- name: Archive
id: archive
shell: bash
run: |
if [[ "${{ matrix.os }}" == "windows-latest" ]]; then
OUTPUT=${{ env.BUILD_RELEASE_OUTPUT }}_${{ matrix.release_tag_os }}_${{ matrix.arch }}.zip
7z a $OUTPUT ${{ env.BUILD_RELEASE_OUTPUT }}.exe
else
OUTPUT=${{ env.BUILD_RELEASE_OUTPUT }}_${{ matrix.release_tag_os }}_${{ matrix.arch }}.tar.gz
tar -czvf $OUTPUT ${{ env.BUILD_RELEASE_OUTPUT }}
fi
echo "output=$OUTPUT" >> "$GITHUB_OUTPUT"
- name: Upload Release Asset
run: gh release upload ${{ github.ref_name }} ${{ steps.archive.outputs.output }}
env:
GH_TOKEN: ${{ secrets.github_token }}
publish_release:
name: Publish Release
needs: [prepare_release,build_release]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Publish Release
run: gh release edit ${{ github.ref_name }} --draft=false
env:
GH_TOKEN: ${{ secrets.github_token }}