-
Notifications
You must be signed in to change notification settings - Fork 101
185 lines (176 loc) · 7.53 KB
/
release.yml
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
name: release
permissions: write-all
on:
push:
tags:
- 'v*'
jobs:
build:
strategy:
matrix:
platform: [ ubuntu-latest]
go-version: [ '1.23' ]
runs-on: ${{ matrix.platform }}
steps:
- name: Test Env
run: |
echo "Tag name from GITHUB_REF_NAME: $GITHUB_REF_NAME"
echo "Tag name from github.ref_name: ${{ github.ref_name }}"
echo "Tag name from github.ref: ${{ github.ref }}"
echo "Runs name: ${{runner.os}}"
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Install dependencies
run: |
go get .
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to ALiYun
uses: docker/login-action@v3
with:
registry: registry.cn-hangzhou.aliyuncs.com
username: ${{ secrets.ALIYUN_USERNAME }}
password: ${{ secrets.ALIYUN_TOKEN }}
- name: Build
run: |
make clean-source
make build PROJECT_NAME=dpanel-amd64 CGO_ENABLED=1
# arm64
curl -Lo arm64.tar.xz https://developer.arm.com/-/media/Files/downloads/gnu/13.3.rel1/binrel/arm-gnu-toolchain-13.3.rel1-x86_64-aarch64-none-linux-gnu.tar.xz
tar -xf arm64.tar.xz
make build PROJECT_NAME=dpanel-arm64 CGO_ENABLED=1 GOARM=7 GOARCH=arm64 GOOS=linux \
CC=${PWD}/arm-gnu-toolchain-13.3.rel1-x86_64-aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu-gcc \
CXX=${PWD}/arm-gnu-toolchain-13.3.rel1-x86_64-aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu-g++
# armv7
curl -Lo arm.tar.xz https://developer.arm.com/-/media/Files/downloads/gnu/13.3.rel1/binrel/arm-gnu-toolchain-13.3.rel1-x86_64-arm-none-linux-gnueabihf.tar.xz
tar -xf arm.tar.xz
make build PROJECT_NAME=dpanel-arm CGO_ENABLED=1 GOARM=7 GOARCH=arm GOOS=linux \
CC=${PWD}/arm-gnu-toolchain-13.3.rel1-x86_64-arm-none-linux-gnueabihf/bin/arm-none-linux-gnueabihf-gcc \
CXX=${PWD}/arm-gnu-toolchain-13.3.rel1-x86_64-arm-none-linux-gnueabihf/bin/arm-none-linux-gnueabihf-g++
# amd64-musl
curl -Lo amd64-musl.tgz https://musl.cc/x86_64-linux-musl-cross.tgz
tar xzf amd64-musl.tgz
make build PROJECT_NAME=dpanel-musl-amd64 CGO_ENABLED=1 \
CC=${PWD}/x86_64-linux-musl-cross/bin/x86_64-linux-musl-gcc \
CXX=${PWD}/x86_64-linux-musl-cross/bin/x86_64-linux-musl-g++
# arm64-musl
curl -Lo arm64-musl.tgz https://musl.cc/aarch64-linux-musl-cross.tgz
tar xzf arm64-musl.tgz
make build PROJECT_NAME=dpanel-musl-arm64 CGO_ENABLED=1 GOARM=7 GOARCH=arm64 GOOS=linux \
CC=${PWD}/aarch64-linux-musl-cross/bin/aarch64-linux-musl-gcc \
CXX=${PWD}/aarch64-linux-musl-cross/bin/aarch64-linux-musl-g++
# arm-musl
curl -Lo arm-musl.tgz https://musl.cc/arm-linux-musleabihf-cross.tgz
tar zxf arm-musl.tgz
make build PROJECT_NAME=dpanel-musl-arm CGO_ENABLED=1 GOARM=7 GOARCH=arm GOOS=linux \
CC=${PWD}/arm-linux-musleabihf-cross/bin/arm-linux-musleabihf-gcc \
CXX=${PWD}/arm-linux-musleabihf-cross/bin/arm-linux-musleabihf-g++
# 群辉 arm
curl -Lo armv8-synology.txz https://global.synologydownload.com/download/ToolChain/toolchain/7.1-42661/Realtek%20RTD129x%20Linux%204.4.180/rtd1296-gcc850_glibc226_armv8-GPL.txz
tar -Jvxf armv8-synology.txz
make build PROJECT_NAME=dpanel-synology-arm64 CGO_ENABLED=1 GOARM=7 GOARCH=arm64 GOOS=linux \
CC=${PWD}/aarch64-unknown-linux-gnu/bin/aarch64-unknown-linux-gnu-gcc \
CXX=${PWD}/aarch64-unknown-linux-gnu/bin/aarch64-unknown-linux-gnu-g++
# 群辉 amd64
curl -Lo amd64-synology.txz https://global.synologydownload.com/download/ToolChain/toolchain/7.1-42661/Intel%20x86%20Linux%204.4.180%20%28GeminiLake%29/geminilake-gcc850_glibc226_x86_64-GPL.txz
tar -Jvxf amd64-synology.txz
make build PROJECT_NAME=dpanel-synology-amd64 CGO_ENABLED=1 \
CC=${PWD}/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-gcc \
CXX=${PWD}/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-g++
- name: Docker BuildX
run: |
docker buildx build \
-t dpanel/dpanel:lite \
-t dpanel/dpanel:${GITHUB_REF_NAME#v}-lite \
-t registry.cn-hangzhou.aliyuncs.com/dpanel/dpanel:lite \
-t registry.cn-hangzhou.aliyuncs.com/dpanel/dpanel:${GITHUB_REF_NAME#v}-lite \
--platform linux/arm64,linux/amd64,linux/arm/v7 \
--build-arg APP_VERSION=${GITHUB_REF_NAME#v} \
-f Dockerfile-lite \
. --push
docker buildx build \
-t dpanel/dpanel:latest \
-t dpanel/dpanel:${GITHUB_REF_NAME#v} \
-t registry.cn-hangzhou.aliyuncs.com/dpanel/dpanel:latest \
-t registry.cn-hangzhou.aliyuncs.com/dpanel/dpanel:${GITHUB_REF_NAME#v}-latest \
--platform linux/arm64,linux/amd64,linux/arm/v7 \
--build-arg APP_VERSION=${GITHUB_REF_NAME#v} \
. --push
- name: upload artifact
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
files: runtime/*
prerelease: false
macos-build:
strategy:
matrix:
platform: [ 'macos-12', 'macos-latest' ]
go-version: [ '1.23' ]
runs-on: ${{ matrix.platform }}
steps:
- name: Test Env
run: |
echo "Tag name from GITHUB_REF_NAME: $GITHUB_REF_NAME"
echo "Tag name from github.ref_name: ${{ github.ref_name }}"
echo "Tag name from github.ref: ${{ github.ref }}"
echo "Runs name: ${{runner.os}}"
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Install dependencies
run: |
go get .
- name: Build
run: |
make clean-source
make build PROJECT_NAME=dpanel-darwin-${{runner.arch}} CGO_ENABLED=1
- name: upload artifact
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
files: runtime/*
prerelease: false
windows-build:
strategy:
matrix:
platform: [ 'windows-latest' ]
go-version: [ '1.23' ]
runs-on: ${{ matrix.platform }}
steps:
- name: Test Env
run: |
echo "Tag name from GITHUB_REF_NAME: $GITHUB_REF_NAME"
echo "Tag name from github.ref_name: ${{ github.ref_name }}"
echo "Tag name from github.ref: ${{ github.ref }}"
echo "Runs name: ${{runner.os}}"
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Install dependencies
run: |
go get .
- name: Build
run: |
set CGO_ENABLED=1
go build -o runtime/dpanel.exe
- name: upload artifact
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
files: runtime/*
prerelease: false