1+ name : Build Go-Proxy-BingAI
2+ on :
3+ push :
4+ tags :
5+ - v*
6+
7+ jobs :
8+ release :
9+ runs-on : ubuntu-latest
10+ outputs :
11+ upload_url : ${{ steps.create_release.outputs.upload_url }}
12+ steps :
13+ - name : Create Release
14+ id : create_release
15+ uses : actions/create-release@v1
16+ env :
17+ GITHUB_TOKEN : ${{ secrets.GH_TOKEN }}
18+ with :
19+ tag_name : ${{ github.ref }}
20+ release_name : ${{ github.ref }}
21+ draft : false
22+ prerelease : false
23+
24+ linuxamd64build :
25+ name : build amd64 version
26+ needs : release
27+ runs-on : ubuntu-latest
28+ steps :
29+ - uses : actions/checkout@v2
30+ - name : Set up Go
31+ uses : actions/setup-go@v4
32+ - name : build linux amd64 version
33+ run : |
34+ go build -ldflags="-s -w" -tags netgo -trimpath -o go-proxy-bingai main.go
35+
36+ - name : package
37+ run : tar -zcvf go-proxy-bingai-linux-amd64.tar.gz go-proxy-bingai
38+ - name : upload
39+ uses : actions/upload-release-asset@v1
40+ env :
41+ GITHUB_TOKEN : ${{ secrets.GH_TOKEN }}
42+ with :
43+ upload_url : ${{ needs.release.outputs.upload_url }}
44+ asset_path : go-proxy-bingai-linux-amd64.tar.gz
45+ asset_name : go-proxy-bingai-linux-amd64.tar.gz
46+ asset_content_type : application/gzip
47+
48+ linuxarm64build :
49+ name : build arm64 version
50+ needs : release
51+ runs-on : ubuntu-latest
52+ steps :
53+ - uses : actions/checkout@v2
54+ - name : Set up Go
55+ uses : actions/setup-go@v4
56+ - name : build linux arm64 version
57+ run : |
58+ go build -ldflags="-s -w" -tags netgo -trimpath -o go-proxy-bingai main.go
59+
60+ - name : package
61+ run : tar -zcvf go-proxy-bingai-linux-arm64.tar.gz go-proxy-bingai
62+ - name : upload
63+ uses : actions/upload-release-asset@v1
64+ env :
65+ GITHUB_TOKEN : ${{ secrets.GH_TOKEN }}
66+ with :
67+ upload_url : ${{ needs.release.outputs.upload_url }}
68+ asset_path : go-proxy-bingai-linux-arm64.tar.gz
69+ asset_name : go-proxy-bingai-linux-arm64.tar.gz
70+ asset_content_type : application/gzip
71+
72+ docker-build :
73+ runs-on : ubuntu-latest
74+
75+ permissions :
76+ packages : write
77+ contents : read
78+
79+ steps :
80+ - uses : actions/checkout@v3
81+
82+ - name : Setup timezone
83+ uses : zcong1993/setup-timezone@master
84+ with :
85+ timezone : Asia/Shanghai
86+
87+ - name : Login to GHCR
88+ uses : docker/login-action@v2
89+ with :
90+ registry : ghcr.io
91+ username : ${{ github.repository_owner }}
92+ password : ${{ secrets.GH_TOKEN }}
93+
94+ - name : Set up QEMU
95+ uses : docker/setup-qemu-action@v2
96+
97+ - name : Set up Docker Buildx
98+ uses : docker/setup-buildx-action@v2
99+
100+ - name : Login to Docker Hub
101+ uses : docker/login-action@v2
102+ with :
103+ username : ${{ secrets.DOCKERHUB_USERNAME }}
104+ password : ${{ secrets.DOCKERHUB_TOKEN }}
105+
106+ - name : Build and push
107+ uses : docker/build-push-action@v4
108+ with :
109+ platforms : linux/amd64,linux/arm64
110+ context : .
111+ file : ./docker/Dockerfile
112+ push : true
113+ tags : |
114+ ghcr.io/${{ github.repository }}:${{ github.ref_name }}
115+ ghcr.io/${{ github.repository }}:latest
116+ docker.io/${{ github.repository }}:${{ github.ref_name }}
117+ docker.io/${{ github.repository }}:latest
118+ cache-from : type=registry,ref=${{ github.repository }}:cache
119+ cache-to : type=registry,ref=${{ github.repository }}:cache,mode=max
0 commit comments