-
Notifications
You must be signed in to change notification settings - Fork 0
109 lines (95 loc) · 2.87 KB
/
packages.yml
File metadata and controls
109 lines (95 loc) · 2.87 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
name: Build Packages
on:
workflow_dispatch:
push:
tags:
- "v*"
jobs:
build:
name: Build (${{ matrix.target }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: linux
archive: gocrt-decoder-linux-amd64.zip
bin_name: gocrt-decoder
- os: windows-latest
target: windows
archive: gocrt-decoder-windows-amd64.zip
bin_name: gocrt-decoder.exe
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Install Linux build dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libgl1-mesa-dev xorg-dev
- name: Install Windows build dependencies
if: runner.os == 'Windows'
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
install: >-
mingw-w64-x86_64-gcc
- name: Add MinGW to PATH
if: runner.os == 'Windows'
shell: pwsh
run: |
Add-Content -Path $env:GITHUB_PATH -Value 'C:\msys64\mingw64\bin'
- name: Download dependencies
run: go mod download
- name: Build and package (Linux)
if: runner.os == 'Linux'
env:
CGO_ENABLED: "1"
run: |
mkdir -p dist/linux-amd64
go build -o dist/linux-amd64/${{ matrix.bin_name }} .
cp README.md LICENSE dist/linux-amd64/
cd dist
zip -r ${{ matrix.archive }} linux-amd64
- name: Build and package (Windows)
if: runner.os == 'Windows'
shell: pwsh
env:
CGO_ENABLED: "1"
CC: gcc
run: |
New-Item -ItemType Directory -Path dist/windows-amd64 -Force | Out-Null
go build -o dist/windows-amd64/${{ matrix.bin_name }} .
Copy-Item README.md dist/windows-amd64/
Copy-Item LICENSE dist/windows-amd64/
Compress-Archive -Path dist/windows-amd64/* -DestinationPath dist/${{ matrix.archive }} -Force
- name: Upload package artifact
uses: actions/upload-artifact@v4
with:
name: package-${{ matrix.target }}
path: dist/${{ matrix.archive }}
if-no-files-found: error
release:
name: Publish Release
needs: build
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: dist/*.zip
generate_release_notes: true