22 workflow_dispatch :
33 inputs :
44 logLevel :
5- description : ' Log level'
5+ description : " Log level"
66 required : true
7- default : ' warning'
7+ default : " warning"
88 type : choice
99 options :
10- - info
11- - warning
12- - debug
10+ - info
11+ - warning
12+ - debug
1313 tags :
14- description : ' Tags'
15- required : false
14+ description : " Tags"
15+ required : false
1616 type : boolean
1717 release :
1818 types : [created]
1919
2020jobs :
2121 releases :
22- name : Release Authorizer Binary
22+ name : Release Authorizer
2323 runs-on : ubuntu-latest
2424 steps :
25- - uses : actions/checkout@v2
25+ - uses : actions/checkout@v3
2626 - uses : actions/setup-node@v2
2727 with :
28- node-version : ' 16'
28+ node-version : " 16"
29+ - # Add support for more platforms with QEMU (optional)
30+ # https://github.com/docker/setup-qemu-action
31+ name : Set up QEMU
32+ uses : docker/setup-qemu-action@v2
33+ - name : Set up Docker Buildx
34+ uses : docker/setup-buildx-action@v2
35+ with :
36+ platforms : linux/amd64,linux/arm64
2937 - uses : actions/setup-go@v2
3038 with :
31- go-version : ' ^1.17.3'
39+ go-version : " ^1.17.3"
3240 - name : Install dependencies
3341 run : |
34- sudo apt-get install build-essential wget zip gcc-mingw-w64 && \
42+ sudo apt-get install build-essential wget zip libc6-dev-arm64-cross && \
3543 echo "/usr/bin/x86_64-w64-mingw32-gcc" >> GITHUB_PATH && \
3644 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 && \
3745 tar -zxf github-assets-uploader.tar.gz && \
@@ -44,25 +52,26 @@ jobs:
4452 run : whereis go
4553 - name : Print Go Version
4654 run : go version
55+ - name : Install gox
56+ run : go install github.com/mitchellh/gox@latest
4757 - name : Set VERSION env
4858 run : echo VERSION=$(basename ${GITHUB_REF}) >> ${GITHUB_ENV}
4959 - name : Copy .env file
5060 run : mv .env.sample .env
51- - name : Package files for windows
52- run : |
53- make clean && \
54- CGO_ENABLED=1 GOOS=windows CC=/usr/bin/x86_64-w64-mingw32-gcc make && \
55- mv build/server build/server.exe && \
56- zip -vr authorizer-${VERSION}-windows-amd64.zip .env app/build build templates dashboard/build
57- - name : Package files for linux
61+ - name : Build package
5862 run : |
5963 make clean && \
60- CGO_ENABLED=1 make && \
61- tar cvfz authorizer-${VERSION}-linux-amd64.tar.gz .env app/build build templates dashboard/build
64+ make build && \
65+ mkdir -p authorizer-${VERSION}-darwin-amd64/build authorizer-${VERSION}-darwin-amd64/app authorizer-${VERSION}-darwin-amd64/dashboard && cp build/darwin/amd64/server authorizer-${VERSION}-darwin-amd64/build/ && cp .env authorizer-${VERSION}-darwin-amd64/.env && cp -rf app/build authorizer-${VERSION}-darwin-amd64/app/build && cp -rf templates authorizer-${VERSION}-darwin-amd64/ && cp -rf dashboard/build authorizer-${VERSION}-darwin-amd64/dashboard/build && tar cvfz authorizer-${VERSION}-darwin-amd64.tar.gz authorizer-${VERSION}-darwin-amd64 && \
66+ mkdir -p authorizer-${VERSION}-linux-amd64/build authorizer-${VERSION}-linux-amd64/app authorizer-${VERSION}-linux-amd64/dashboard && cp build/linux/amd64/server authorizer-${VERSION}-linux-amd64/build/ && cp .env authorizer-${VERSION}-linux-amd64/.env && cp -rf app/build authorizer-${VERSION}-linux-amd64/app/build && cp -rf templates authorizer-${VERSION}-linux-amd64/ && cp -rf dashboard/build authorizer-${VERSION}-linux-amd64/dashboard/build && tar cvfz authorizer-${VERSION}-linux-amd64.tar.gz authorizer-${VERSION}-linux-amd64 && \
67+ mkdir -p authorizer-${VERSION}-linux-arm64/build authorizer-${VERSION}-linux-arm64/app authorizer-${VERSION}-linux-arm64/dashboard && cp build/linux/arm64/server authorizer-${VERSION}-linux-arm64/build/ && cp .env authorizer-${VERSION}-linux-arm64/.env && cp -rf app/build authorizer-${VERSION}-linux-arm64/app/build && cp -rf templates authorizer-${VERSION}-linux-arm64/ && cp -rf dashboard/build authorizer-${VERSION}-linux-arm64/dashboard/build && tar cvfz authorizer-${VERSION}-linux-arm64.tar.gz authorizer-${VERSION}-linux-arm64 && \
68+ mkdir -p authorizer-${VERSION}-windows-amd64/build authorizer-${VERSION}-windows-amd64/app authorizer-${VERSION}-windows-amd64/dashboard && cp build/windows/amd64/server.exe authorizer-${VERSION}-windows-amd64/build/ && cp .env authorizer-${VERSION}-windows-amd64/.env && cp -rf app/build authorizer-${VERSION}-windows-amd64/app/build && cp -rf templates authorizer-${VERSION}-windows-amd64/ && cp -rf dashboard/build authorizer-${VERSION}-windows-amd64/dashboard/build && zip -vr authorizer-${VERSION}-windows-amd64.zip authorizer-${VERSION}-windows-amd64
6269 - name : Upload assets
6370 run : |
64- github-assets-uploader -f authorizer-${VERSION}-windows -amd64.zip -mediatype application/zip -repo authorizerdev/authorizer -token ${{secrets.RELEASE_TOKEN}} -tag ${VERSION} && \
71+ github-assets-uploader -f authorizer-${VERSION}-darwin -amd64.tar.gz -mediatype application/gzip -repo authorizerdev/authorizer -token ${{secrets.RELEASE_TOKEN}} -tag ${VERSION}
6572 github-assets-uploader -f authorizer-${VERSION}-linux-amd64.tar.gz -mediatype application/gzip -repo authorizerdev/authorizer -token ${{secrets.RELEASE_TOKEN}} -tag ${VERSION}
73+ github-assets-uploader -f authorizer-${VERSION}-linux-arm64.tar.gz -mediatype application/gzip -repo authorizerdev/authorizer -token ${{secrets.RELEASE_TOKEN}} -tag ${VERSION}
74+ github-assets-uploader -f authorizer-${VERSION}-windows-amd64.zip -mediatype application/zip -repo authorizerdev/authorizer -token ${{secrets.RELEASE_TOKEN}} -tag ${VERSION}
6675 - name : Log in to Docker Hub
6776 uses : docker/login-action@v1
6877 with :
7483 uses : docker/metadata-action@v3
7584 with :
7685 images : lakhansamani/authorizer
86+ flavor : |
87+ latest=false
88+ tags : |
89+ type=schedule
90+ type=ref,event=branch
91+ type=ref,event=tag
92+ type=ref,event=pr
93+ type=raw,value=latest,enable={{is_default_branch}}
7794
7895 - name : Build and push Docker image
7996 uses : docker/build-push-action@v2
8299 push : true
83100 tags : ${{ steps.meta.outputs.tags }}
84101 labels : ${{ steps.meta.outputs.labels }}
102+ platforms : linux/amd64,linux/arm64
85103 build-args : |
86104 VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
0 commit comments