Compare commits

..

6 Commits

Author SHA1 Message Date
Lakhan Samani
8d6e218bf4 fix: go installation 2021-09-11 15:51:10 +05:30
Lakhan Samani
ee83d00866 fix: add linux build 2021-09-11 13:51:00 +05:30
Lakhan Samani
3b39c71835 fix: make command 2021-09-11 12:57:32 +05:30
Lakhan Samani
a4cb86b386 fix: value substitution in release 2021-09-11 12:52:39 +05:30
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
2 changed files with 30 additions and 31 deletions

View File

@@ -3,52 +3,51 @@ on:
types: [created]
jobs:
releases-windows:
releases:
name: Release Authorizer Binary
runs-on: ubuntu-latest
strategy:
matrix:
goos: [windows]
goarch: [amd64]
steps:
- uses: actions/checkout@v2
- name: Install dependencies
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 && \
sudo apt-get install build-essential wget zip gcc-mingw-w64 && \
sudo apt-get remove --auto-remove golang-go && \
sudo rm -rf /usr/bin/go &&\
sudo rm -rf /usr/local/go && \
wget --progress=dot:mega https://golang.org/dl/go1.17.1.linux-amd64.tar.gz -O go-linux.tar.gz && \
sudo tar -zxf go-linux.tar.gz && \
sudo mv go /usr/local/ && \
sudo mkdir -p /go/bin /go/src /go/pkg && \
export GO_HOME=/usr/local/go && \
export GOPATH=/go && \
export PATH=${GOPATH}/bin:${GO_HOME}/bin/:$PATH && \
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 && \
mv github-assets-uploader /usr/sbin/ && \
rm -f 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 paths
run: whereis go
- 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
run: echo VERSION=$(basename ${GITHUB_REF}) >> ${GITHUB_ENV}
- name: Echo Version
run: echo ${VERSION}
- name: Set CGO_ENABLED env
run: echo CGO_ENABLED=1 >> ${GITHUB_ENV}
- name: Set GOOS env
env: GOOS=${{matrix.goos}}
- name: Set Windows C Compiler GO env
if: ${{ matrix.goos == 'windows'}}
run: echo CC=/usr/bin/x86_64-w64-mingw32-gcc >> ${GITHUB_ENV}
- name: Create build
run: make clean && make build
- name: Package files
if: ${{ matrix.goos == 'windows'}}
run: make clean && make
- name: Package files for windows
run: |
make clean && CGO_ENABLED=1 GOOS=windows CC=/usr/bin/x86_64-w64-mingw32-gcc make
mv .env.sample .env && \
zip -vr authorizer-${VERSION}-windows-${matrix.goarch}.zip .env app build template && \
github-assets-uploader -f authorizer-${VERSION}-windows-${matrix.goarch}.zip -mediatype application/zip -repo authorizerdev/authorizer -token ${secrets.RELEASE_TOKEN} -tag ${VERSION}
zip -vr authorizer-${VERSION}-windows-amd64.zip .env app build templates
- name: Package files for linux
run: |
make clean && CGO_ENABLED=1 make
mv .env.sample .env && \
tar cvfz authorizer-${VERSION}-linux-amd64.tar.gz .env app build templates
- name: Upload assets
run: |
github-assets-uploader -f authorizer-${VERSION}-windows-amd64.zip -mediatype application/zip -repo authorizerdev/authorizer -token ${{secrets.RELEASE_TOKEN}} -tag ${VERSION} && \
github-assets-uploader -f authorizer-${VERSION}-linux-amd64.tar.gz -mediatype application/gzip -repo authorizerdev/authorizer -token ${{secrets.RELEASE_TOKEN}} -tag ${VERSION} && \
# - uses: wangyoucao577/go-release-action@v1.20
# with:

View File

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