Compare commits

..

8 Commits

Author SHA1 Message Date
Lakhan Samani
00e1397586 fix: permission for github-asset-uploader 2021-09-11 12:49:15 +05:30
Lakhan Samani
939852cb05 fix: use native build 2021-09-11 12:47:31 +05:30
Lakhan Samani
7d71f66080 fix: use native build 2021-09-11 12:45:04 +05:30
Lakhan Samani
7ec91b5b5e fix: mingw path 2021-09-11 11:57:52 +05:30
Lakhan Samani
425d14e3af fix: dependency package for win build 2021-09-11 11:52:52 +05:30
Lakhan Samani
1575047197 fix: add conditional env 2021-09-11 11:36:54 +05:30
Lakhan Samani
1942b251c7 fix: install mingw-64 for windows 2021-09-11 11:32:59 +05:30
Lakhan Samani
73219067f4 fix: fix env set in release.yml 2021-09-11 11:19:58 +05:30
2 changed files with 45 additions and 50 deletions

View File

@@ -3,63 +3,58 @@ on:
types: [created] types: [created]
jobs: jobs:
- releases-windows: releases-windows:
name: Release Authorizer Binary name: Release Authorizer Binary
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
# build and publish in parallel: linux/386, linux/amd64, windows/386, windows/amd64, darwin/amd64
goos: [windows] goos: [windows]
goarch: [amd64] goarch: [amd64]
# goarch: ['386', amd64]
# exclude:
# - goarch: '386'
# goos: darwin
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Install dependencies - name: Install dependencies
run: sudo apt-get install build-essential gcc_mingw64 run: |
sudo apt-get install build-essential wget zip && \
wget https://golang.org/dl/go1.17.1.linux-amd64.tar.gz && \
sudo tar -C /usr/local -xzf go1.17.1.linux-amd64.tar.gz && \
echo PATH=$PATH:/usr/local/go/bin >> ~/.bashrc && \
source ~/.bashrc && \
export PATH=$PATH:/usr/local/go/bin && \
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 && \
tar -zxf github-assets-uploader.tar.gz && \
sudo mv github-assets-uploader /usr/sbin/ && \
sudo rm -f github-assets-uploader.tar.gz && \
github-assets-uploader -version
- name: Print Go Version
run: go version
- name: Install windows dependencies
if: ${{ matrix.goos == 'windows'}}
run: sudo apt-get install gcc-mingw-w64
- name: Set VERSION env - name: Set VERSION env
run: echo VERSION=$(basename ${GITHUB_REF}) >> ${GITHUB_ENV} run: echo VERSION=$(basename ${GITHUB_REF}) >> ${GITHUB_ENV}
- name: Set GO env - name: Echo Version
env: run: echo ${VERSION}
- CGO_ENABLED=1 - name: Set CGO_ENABLED env
- CC=x86_64-w64-mingw32-gcc run: echo CGO_ENABLED=1 >> ${GITHUB_ENV} && echo GOOS=${matrix.goos} >> ${GITHUB_ENV}
- uses: wangyoucao577/go-release-action@v1.20 - name: CAT ENV
with: run: cat ${GITHUB_ENV}
github_token: ${{ secrets.RELEASE_TOKEN }} - name: Set Windows C Compiler GO env
goos: ${{ matrix.goos }} if: ${{ matrix.goos == 'windows'}}
goarch: ${{ matrix.goarch }} run: echo CC=/usr/bin/x86_64-w64-mingw32-gcc >> ${GITHUB_ENV}
build_command: make clean && make - name: Create build
md5sum: FALSE run: make clean && make build
extra_files: .env.sample app build template - name: Package files
- releases-darwin: if: ${{ matrix.goos == 'windows'}}
name: Release Authorizer Binary run: |
runs-on: ubuntu-latest mv .env.sample .env && \
strategy: zip -vr authorizer-${VERSION}-windows-${matrix.goarch}.zip .env app build template && \
matrix: github-assets-uploader -f authorizer-${VERSION}-windows-${matrix.goarch}.zip -mediatype application/zip -repo authorizerdev/authorizer -token ${secrets.RELEASE_TOKEN} -tag ${VERSION}
# build and publish in parallel: linux/386, linux/amd64, windows/386, windows/amd64, darwin/amd64
goos: [darwin] # - uses: wangyoucao577/go-release-action@v1.20
goarch: [amd64] # with:
# goarch: ['386', amd64] # github_token: ${{ secrets.RELEASE_TOKEN }}
# exclude: # goos: ${{ matrix.goos }}
# - goarch: '386' # goarch: ${{ matrix.goarch }}
# goos: darwin # build_command: make clean && make
steps: # md5sum: FALSE
- uses: actions/checkout@v2 # extra_files: .env.sample app build template
- name: Install dependencies
run: sudo apt-get install build-essential gcc g++ zlib1g-dev libmpc-dev libmpfr-dev libgmp-dev
- name: Set VERSION env
run: echo VERSION=$(basename ${GITHUB_REF}) >> ${GITHUB_ENV}
- name: Set GO env
env:
- CGO_ENABLED=1
- CC=o64-clang
- uses: wangyoucao577/go-release-action@v1.20
with:
github_token: ${{ secrets.RELEASE_TOKEN }}
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
build_command: make clean && make
md5sum: FALSE
extra_files: .env.sample app build template

View File

@@ -2,6 +2,6 @@ DEFAULT_VERSION=0.1.0-local
VERSION := $(or $(VERSION),$(DEFAULT_VERSION)) VERSION := $(or $(VERSION),$(DEFAULT_VERSION))
cmd: cmd:
cd server && go build -ldflags "-w -X main.Version=$(VERSION)" -o '../build/server' cd server && CGO_ENABLED=1 GOOS=$(GOOS) CC=$(CC) go build -ldflags "-w -X main.Version=$(VERSION)" -o '../build/server'
clean: clean:
rm -rf build rm -rf build