Compare commits

...

29 Commits

Author SHA1 Message Date
Lakhan Samani
a6a46b8d95 feat: add mac script
fix: release script
2021-09-11 22:30:05 +05:30
Lakhan Samani
5667d8dbb6 fix: env file path 2021-09-11 16:16:18 +05:30
Lakhan Samani
602c33a1eb fix: remove raw build command 2021-09-11 16:12:42 +05:30
Lakhan Samani
f5ca38ef0b fix: add go bin path to GITHUB_PATH 2021-09-11 16:10:12 +05:30
Lakhan Samani
5531f86da1 fix: path of go installation 2021-09-11 16:02:33 +05:30
Lakhan Samani
cdb497123b fix: add debug point 2021-09-11 15:58:57 +05:30
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
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
Lakhan Samani
252aebce4b fix: add different jobs for windows and darwin with expected Go envs 2021-09-11 11:15:15 +05:30
Lakhan Samani
05cf85e0e5 fix: make file 2021-09-11 07:41:03 +05:30
Lakhan Samani
89725c2da2 fix: make file 2021-09-11 07:08:19 +05:30
Lakhan Samani
4d3fbeee8f fix: remove darwin build 2021-09-10 22:54:37 +05:30
Lakhan Samani
0b54c48f04 fix: remove darwin build 2021-09-10 22:54:31 +05:30
Lakhan Samani
496b267cc4 fix: add cross compile libs 2021-09-10 22:51:15 +05:30
Lakhan Samani
c72c8d3232 fix: release action 2021-09-10 22:45:48 +05:30
Lakhan Samani
acab410141 fix: remove windows from automated build 2021-09-10 17:51:32 +05:30
Lakhan Samani
695614497c fix: use cgo enabled for windows and linux 2021-09-10 14:52:29 +05:30
Lakhan Samani
55e6357a5f fix: remove cgo from build 2021-09-09 12:02:16 +05:30
Lakhan Samani
bbfbe71d95 fix: release action 2021-09-09 11:50:54 +05:30
4 changed files with 71 additions and 18 deletions

View File

@@ -3,24 +3,57 @@ on:
types: [created] types: [created]
jobs: jobs:
releases-matrix: releases:
name: Release Authorizer Binary name: Release Authorizer Binary
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
matrix:
# build and publish in parallel: linux/386, linux/amd64, windows/386, windows/amd64, darwin/amd64
goos: [linux, windows, darwin]
goarch: amd64
# goarch: ['386', amd64]
# exclude:
# - goarch: '386'
# goos: darwin
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: wangyoucao577/go-release-action@v1.20 - name: Install dependencies
with: run: |
github_token: ${{ secrets.RELEASE_TOKEN }} sudo apt-get install build-essential wget zip gcc-mingw-w64 && \
goos: ${{ matrix.goos }} sudo apt-get remove --auto-remove golang-go && \
goarch: ${{ matrix.goarch }} sudo rm -rf /usr/bin/go &&\
build_command: make clean && make wget --progress=dot:mega https://golang.org/dl/go1.17.1.linux-amd64.tar.gz -O go-linux.tar.gz && \
extra_files: .env.sample app build sudo tar -zxf go-linux.tar.gz && \
sudo mv go /usr/bin/ && \
sudo mkdir -p /go/bin /go/src /go/pkg && \
export GO_HOME=/usr/bin/go && \
export GOPATH=/go && \
export PATH=${GOPATH}/bin:${GO_HOME}/bin/:$PATH && \
echo "/usr/bin/go/bin" >> $GITHUB_PATH
echo "/usr/bin/x86_64-w64-mingw32-gcc" >> GITHUB_PATH
go version && \
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 paths
run: whereis go
- name: Print Go Version
run: go version
- name: Set VERSION env
run: echo VERSION=$(basename ${GITHUB_REF}) >> ${GITHUB_ENV}
- name: Copy .env file
run: mv .env.sample .env
- name: Package files for windows
run: |
make clean && CGO_ENABLED=1 GOOS=windows CC=/usr/bin/x86_64-w64-mingw32-gcc make
zip -vr authorizer-${VERSION}-windows-amd64.zip .env app build templates
- name: Package files for linux
run: |
make clean && CGO_ENABLED=1 make
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:
# 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

2
.gitignore vendored
View File

@@ -6,3 +6,5 @@ build
.env .env
data.db data.db
.DS_Store .DS_Store
.env.local
*.tar.gz

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 && CGO_ENABLED=1 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: clean:
rm -rf build rm -rf build

18
scripts/build-mac.sh Normal file
View File

@@ -0,0 +1,18 @@
VERSION="$1"
# make clean && CGO_ENABLED=1 make
FILE_NAME=authorizer-${VERSION}-darwin-amd64.tar.gz
# tar cvfz ${FILE_NAME} .env app build templates
AUTH="Authorization: token $GITHUB_TOKEN"
RELASE_INFO=$(curl -sH "$AUTH" https://api.github.com/repos/authorizerdev/authorizer/releases/tags/${VERSION})
echo $RELASE_INFO
eval $(echo "$RELASE_INFO" | grep -m 1 "id.:" | grep -w id | tr : = | tr -cd '[[:alnum:]]=')
[ "$id" ] || { echo "Error: Failed to get release id for tag: $VERSION"; echo "$RELASE_INFO" | awk 'length($0)<100' >&2; exit 1; }
echo $id
GH_ASSET="https://uploads.github.com/repos/authorizerdev/authorizer/releases/$id/assets?name=$(basename $FILE_NAME)"
echo $GH_ASSET
curl -H $AUTH -H "Content-Type: $(file -b --mime-type $FILE_NAME)" --data-binary @$FILE_NAME $GH_ASSET
curl "$GITHUB_OAUTH_BASIC" --data-binary @"$FILE_NAME" -H "Authorization: token $GITHUB_TOKEN" -H "Content-Type: application/octet-stream" $GH_ASSET