-
Notifications
You must be signed in to change notification settings - Fork 0
139 lines (118 loc) · 3.54 KB
/
Copy pathrelease.yml
File metadata and controls
139 lines (118 loc) · 3.54 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
name: Build Release
on:
push:
tags:
- 'v*.*.*'
jobs:
changelog:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Generate release notes
run: |
npx auto-changelog-plus --starting-version ${{ github.ref_name }}
sed -i '1,4d' CHANGELOG.md
- name: Upload changelog
uses: actions/upload-artifact@v4
with:
name: changelog
path: CHANGELOG.md
build:
runs-on: ${{ matrix.os }}
needs: changelog
if: always() && (needs.changelog.result == 'success' || needs.changelog.result == 'skipped')
strategy:
fail-fast: false
matrix:
include:
# ===== Windows =====
- os: windows-latest
goos: windows
goarch: amd64
platform: windows-amd64
ext: .exe
# ===== Linux =====
- os: ubuntu-latest
goos: linux
goarch: amd64
platform: linux-amd64
ext: ""
- os: ubuntu-22.04
goos: linux
goarch: arm64
platform: linux-arm64
ext: ""
- os: ubuntu-22.04
goos: linux
goarch: arm
goarm: "7"
platform: linux-armv7
ext: ""
# ===== macOS =====
- os: macos-15-intel
goos: darwin
goarch: amd64
platform: darwin-amd64
ext: ""
- os: macos-latest
goos: darwin
goarch: arm64
platform: darwin-arm64
ext: ""
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: src/go.mod
- name: Build
shell: bash
run: |
export CGO_ENABLED=0
export GOOS=${{ matrix.goos }}
export GOARCH=${{ matrix.goarch }}
[ -n "${{ matrix.goarm }}" ] && export GOARM=${{ matrix.goarm }}
cd src
go build \
-ldflags "-s -w -X main.version=${{ github.ref_name }}" \
-o ../dist/portrelay${{ matrix.ext }} \
.
- name: Rename binary
shell: bash
run: |
mkdir -p dist
mv dist/portrelay${{ matrix.ext }} \
dist/PortRelay-${{ github.ref_name }}-${{ matrix.platform }}${{ matrix.ext }}
- name: Package (Linux / macOS)
if: runner.os != 'Windows'
run: |
cd dist
zip ../PortRelay-${{ github.ref_name }}-${{ matrix.platform }}.zip \
PortRelay-${{ github.ref_name }}-${{ matrix.platform }}${{ matrix.ext }}
- name: Package (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
Compress-Archive -Path "dist\PortRelay-${{ github.ref_name }}-${{ matrix.platform }}${{ matrix.ext }}" `
-DestinationPath "PortRelay-${{ github.ref_name }}-${{ matrix.platform }}.zip"
- name: Download changelog
uses: actions/download-artifact@v4
with:
name: changelog
- name: Upload Release Asset
uses: softprops/action-gh-release@v2
with:
body_path: CHANGELOG.md
files: PortRelay-${{ github.ref_name }}-${{ matrix.platform }}.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}