Skip to content

Commit ee83d00

Browse files
committed
fix: add linux build
1 parent 3b39c71 commit ee83d00

File tree

2 files changed

+17
-23
lines changed

2 files changed

+17
-23
lines changed

.github/workflows/release.yaml

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,17 @@ on:
33
types: [created]
44

55
jobs:
6-
releases-windows:
6+
releases:
77
name: Release Authorizer Binary
88
runs-on: ubuntu-latest
9-
strategy:
10-
matrix:
11-
goos: [windows]
12-
goarch: [amd64]
139
steps:
1410
- uses: actions/checkout@v2
1511
- name: Install dependencies
1612
run: |
17-
sudo apt-get install build-essential wget zip && \
13+
sudo apt-get install build-essential wget zip gcc-mingw-w64 && \
1814
wget https://golang.org/dl/go1.17.1.linux-amd64.tar.gz && \
15+
sudo apt-get remove --auto-remove golang-go && \
16+
sudo rm -rf /usr/bin/go &&\
1917
sudo rm -rf /usr/local/go && \
2018
sudo tar -C /usr/local -xzf go1.17.1.linux-amd64.tar.gz && \
2119
echo PATH=$PATH:/usr/local/go/bin >> ~/.bashrc && \
@@ -30,28 +28,24 @@ jobs:
3028
run: whereis go
3129
- name: Print Go Version
3230
run: go version
33-
- name: Install windows dependencies
34-
if: ${{ matrix.goos == 'windows'}}
35-
run: sudo apt-get install gcc-mingw-w64
3631
- name: Set VERSION env
3732
run: echo VERSION=$(basename ${GITHUB_REF}) >> ${GITHUB_ENV}
38-
- name: Echo Version
39-
run: echo ${VERSION}
40-
- name: Set CGO_ENABLED env
41-
run: echo CGO_ENABLED=1 >> ${GITHUB_ENV} && echo GOOS=${{matrix.goos}} >> ${GITHUB_ENV}
42-
- name: CAT ENV
43-
run: cat ${GITHUB_ENV}
44-
- name: Set Windows C Compiler GO env
45-
if: ${{ matrix.goos == 'windows'}}
46-
run: echo CC=/usr/bin/x86_64-w64-mingw32-gcc >> ${GITHUB_ENV}
4733
- name: Create build
4834
run: make clean && make
49-
- name: Package files
50-
if: ${{ matrix.goos == 'windows'}}
35+
- name: Package files for windows
5136
run: |
37+
make clean && CGO_ENABLED=1 GOOS=windows CC=/usr/bin/x86_64-w64-mingw32-gcc make
5238
mv .env.sample .env && \
53-
zip -vr authorizer-${VERSION}-windows-${{matrix.goarch}}.zip .env app build template && \
54-
github-assets-uploader -f authorizer-${VERSION}-windows-${{matrix.goarch}}.zip -mediatype application/zip -repo authorizerdev/authorizer -token ${{secrets.RELEASE_TOKEN}} -tag ${VERSION}
39+
zip -vr authorizer-${VERSION}-windows-amd64.zip .env app build templates
40+
- name: Package files for linux
41+
run: |
42+
make clean && CGO_ENABLED=1 make
43+
mv .env.sample .env && \
44+
tar cvfz authorizer-${VERSION}-linux-amd64.tar.gz .env app build templates
45+
- name: Upload assets
46+
run: |
47+
github-assets-uploader -f authorizer-${VERSION}-windows-amd64.zip -mediatype application/zip -repo authorizerdev/authorizer -token ${{secrets.RELEASE_TOKEN}} -tag ${VERSION} && \
48+
github-assets-uploader -f authorizer-${VERSION}-linux-amd64.tar.gz -mediatype application/gzip -repo authorizerdev/authorizer -token ${{secrets.RELEASE_TOKEN}} -tag ${VERSION} && \
5549
5650
# - uses: wangyoucao577/[email protected]
5751
# with:

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 && CGO_ENABLED=1 GOOS=$(GOOS) CC=$(CC) go build -ldflags "-w -X main.Version=$(VERSION)" -o '../build/server'
5+
cd server && go build -ldflags "-w -X main.Version=$(VERSION)" -o '../build/server'
66
clean:
77
rm -rf build

0 commit comments

Comments
 (0)