-
Notifications
You must be signed in to change notification settings - Fork 85
170 lines (164 loc) · 6.54 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
name: release
permissions: write-all
on:
push:
tags:
- 'v*'
jobs:
build:
strategy:
matrix:
platform: [ ubuntu-latest]
go-version: [ '1.22' ]
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++
- 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.22' ]
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.22' ]
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