Skip to content

Commit 7d71f66

Browse files
committed
fix: use native build
1 parent 7ec91b5 commit 7d71f66

File tree

2 files changed

+37
-11
lines changed

2 files changed

+37
-11
lines changed

.github/workflows/release.yaml

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,48 @@ jobs:
1313
steps:
1414
- uses: actions/checkout@v2
1515
- name: Install dependencies
16-
run: sudo apt-get install build-essential
16+
run: |
17+
sudo apt-get install build-essential wget zip && \
18+
wget https://golang.org/dl/go1.17.1.linux-amd64.tar.gz && \
19+
sudo tar -C /usr/local -xzf go1.17.1.linux-amd64.tar.gz && \
20+
echo PATH=$PATH:/usr/local/go/bin >> ~/.bashrc && \
21+
source ~/.bashrc && \
22+
export PATH=$PATH:/usr/local/go/bin && \
23+
wget --no-check-certificate --progress=dot:mega https://github.com/wangyoucao577/assets-uploader/releases/download/v0.3.0/github-assets-uploader-v0.3.0-linux-amd64.tar.gz -O github-assets-uploader.tar.gz && \
24+
tar -zxf github-assets-uploader.tar.gz && \
25+
mv github-assets-uploader /usr/sbin/ && \
26+
rm -f github-assets-uploader.tar.gz && \
27+
github-assets-uploader -version
28+
- name: Print Go Version
29+
run: go version
1730
- name: Install windows dependencies
1831
if: ${{ matrix.goos == 'windows'}}
1932
run: sudo apt-get install gcc-mingw-w64
2033
- name: Set VERSION env
2134
run: echo VERSION=$(basename ${GITHUB_REF}) >> ${GITHUB_ENV}
22-
- name: Set GO_ENABLED env
35+
- name: Echo Version
36+
run: echo ${VERSION}
37+
- name: Set CGO_ENABLED env
2338
run: echo CGO_ENABLED=1 >> ${GITHUB_ENV}
39+
- name: Set GOOS env
40+
env: GOOS=${{matrix.goos}}
2441
- name: Set Windows C Compiler GO env
2542
if: ${{ matrix.goos == 'windows'}}
2643
run: echo CC=/usr/bin/x86_64-w64-mingw32-gcc >> ${GITHUB_ENV}
27-
- uses: wangyoucao577/[email protected]
28-
with:
29-
github_token: ${{ secrets.RELEASE_TOKEN }}
30-
goos: ${{ matrix.goos }}
31-
goarch: ${{ matrix.goarch }}
32-
build_command: make clean && make
33-
md5sum: FALSE
34-
extra_files: .env.sample app build template
44+
- name: Create build
45+
run: make clean && make build
46+
- name: Package files
47+
if: ${{ matrix.goos == 'windows'}}
48+
run: |
49+
mv .env.sample .env && \
50+
zip -vr authorizer-${VERSION}-windows-${matrix.goarch}.zip .env app build template && \
51+
github-assets-uploader -f authorizer-${VERSION}-windows-${matrix.goarch}.zip -mediatype application/zip -repo authorizerdev/authorizer -token ${secrets.RELEASE_TOKEN} -tag ${VERSION}
52+
53+
# - uses: wangyoucao577/[email protected]
54+
# with:
55+
# github_token: ${{ secrets.RELEASE_TOKEN }}
56+
# goos: ${{ matrix.goos }}
57+
# goarch: ${{ matrix.goarch }}
58+
# build_command: make clean && make
59+
# md5sum: FALSE
60+
# extra_files: .env.sample app build template

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ DEFAULT_VERSION=0.1.0-local
22
VERSION := $(or $(VERSION),$(DEFAULT_VERSION))
33

44
cmd:
5-
cd server && go build -ldflags "-w -X main.Version=$(VERSION)" -o '../build/server'
5+
cd server && CGO_ENABLED=1 GOOS=$(GOOS) CC=$(CC) go build -ldflags "-w -X main.Version=$(VERSION)" -o '../build/server'
66
clean:
77
rm -rf build

0 commit comments

Comments
 (0)