3
0
corteza/.github/workflows/release.yml
2022-02-17 17:21:01 +01:00

118 lines
3.1 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.17
- 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
build-web-console:
runs-on: ubuntu-latest
needs:
- test
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '16'
- uses: actions/cache@v2
if: ${{ !env.ACT }}
with:
path: ~/.npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.OS }}-node-
- name: Install dependencies
working-directory: ./webconsole
run: yarn install
- name: Build Package
working-directory: ./webconsole
run: yarn build
release-linux:
runs-on: ubuntu-latest
needs:
- build-web-console
env:
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.17
- run: make release-clean release
- run: make upload
if: ${{ !env.ACT }}
release-darwin:
runs-on: macos-latest
needs:
- build-web-console
env:
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.17
- 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:
- build-web-console
- release-linux
env:
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 --build-arg "VERSION=${{ env.BUILD_VERSION }}" \
-t cortezaproject/corteza-server:${{ env.BUILD_VERSION }} .
if: ${{ !env.ACT }}
- run: docker push cortezaproject/corteza-server:${{ env.BUILD_VERSION }}
if: ${{ !env.ACT }}