3
0
corteza/.github/workflows/release.yml
2021-07-08 07:38:18 +02:00

101 lines
2.7 KiB
YAML

name: release
on:
push:
tags:
- '**'
jobs:
test:
runs-on: ubuntu-latest
env:
GOFLAGS: -mod=readonly
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v1
with:
go-version: 1.16
- uses: actions/cache@v2
if: ${{ !env.ACT }}
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-
- run: make test.all
release-linux:
runs-on: ubuntu-latest
needs:
- test
env:
GOFLAGS: -mod=readonly
BUILD_OS: linux
BUILD_ARCH: amd64
RELEASE_SFTP_KEY: ${{ secrets.RELEASE_SFTP_KEY }}
RELEASE_SFTP_URI: ${{ secrets.RELEASE_SFTP_URI }}
steps:
- run: echo "BUILD_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- uses: actions/checkout@v2
- uses: actions/setup-go@v1
with:
go-version: 1.16
- uses: actions/cache@v2
if: ${{ !env.ACT }}
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-
- run: make release-clean release
- run: make upload
if: ${{ !env.ACT }}
release-darwin:
runs-on: macos-latest
needs:
- test
env:
GOFLAGS: -mod=readonly
BUILD_OS: darwin
BUILD_ARCH: amd64
BUILD_VERSION: ${{ format(github.ref, 'refs/tags/', '') }}
RELEASE_SFTP_KEY: ${{ secrets.RELEASE_SFTP_KEY }}
RELEASE_SFTP_URI: ${{ secrets.RELEASE_SFTP_URI }}
steps:
- run: echo "BUILD_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- uses: actions/checkout@v2
- uses: actions/setup-go@v1
with:
go-version: 1.16
- uses: actions/cache@v2
if: ${{ !env.ACT }}
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-
- run: make release-clean release
- run: make upload
if: ${{ !env.ACT }}
release-docker:
runs-on: ubuntu-latest
needs:
- test
env:
GOFLAGS: -mod=readonly
BUILD_OS: linux
BUILD_ARCH: amd64
steps:
- run: echo "BUILD_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- uses: actions/checkout@v2
- uses: docker/login-action@v1
if: ${{ !env.ACT }}
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- run: docker build -t cortezaproject/corteza-server:${{ env.BUILD_VERSION }} .
if: ${{ !env.ACT }}
- run: docker push cortezaproject/corteza-server:${{ env.BUILD_VERSION }}
if: ${{ !env.ACT }}