77 lines
2.9 KiB
YAML
77 lines
2.9 KiB
YAML
on:
|
|
release:
|
|
types: [created]
|
|
|
|
jobs:
|
|
releases:
|
|
name: Release Authorizer Binary
|
|
strategy:
|
|
matrix:
|
|
go-version: [1.16.4]
|
|
platform: [ubuntu-18.04]
|
|
runs-on: ${{ matrix.platform }}
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: Install Go
|
|
uses: actions/setup-go@v2
|
|
with:
|
|
go-version: ${{ matrix.go-version }}
|
|
# - name: Install dependencies
|
|
# run: |
|
|
# sudo apt-get install build-essential wget zip && \
|
|
# 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: Set Github token env
|
|
run: echo GITHUB_TOKEN=${secrets.RELEASE_TOKEN} >> ${GITHUB_TOKEN}
|
|
- 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 && \
|
|
# mv build/server build/server.exe && \
|
|
# zip -vr authorizer-${VERSION}-windows-amd64.zip .env app/build 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 build templates
|
|
- name: Upload asset
|
|
uses: softprops/action-gh-release@v1
|
|
with:
|
|
files: authorizer-${VERSION}-linux-amd64.tar.gz
|
|
# - name: Upload assets
|
|
# run: |
|
|
# github-assets-uploader -f authorizer-${VERSION}-linux-amd64.tar.gz -mediatype application/gzip -repo authorizerdev/authorizer -token ${{secrets.RELEASE_TOKEN}} -tag ${VERSION}
|
|
- name: Log in to Docker Hub
|
|
uses: docker/login-action@v1
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
- name: Extract metadata (tags, labels) for Docker
|
|
id: meta
|
|
uses: docker/metadata-action@v3
|
|
with:
|
|
images: lakhansamani/authorizer
|
|
|
|
- name: Build and push Docker image
|
|
uses: docker/build-push-action@v2
|
|
with:
|
|
context: .
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
build-args: |
|
|
VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
|