3
0
Files
corteza/.github/workflows/snapshot.yml
2021-07-08 08:50:30 +02:00

63 lines
1.7 KiB
YAML

name: snapshot
on:
push:
branches:
- 2021.3.x*
- 2021.6.x*
- 2021.9.x*
- 2021.12.x*
- 2022.3.x*
- 2022.9.x*
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
snapshot-docker:
runs-on: ubuntu-latest
needs:
- test
env:
GOFLAGS: -mod=readonly
BUILD_OS: linux
BUILD_ARCH: amd64
BUILD_VERSION_SHA: ${GITHUB_SHA}
steps:
- run: echo "BUILD_VERSION_REF=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
- uses: actions/checkout@v2
- uses: docker/login-action@v1
if: ${{ !env.ACT }}
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: docker/login-action@v1
if: ${{ !env.ACT }}
with:
registry: ghcr.io
username: ${{ secrets.GH_USERNAME }}
password: ${{ secrets.GH_TOKEN }}
- run: |
docker build -t ghcr.io/cortezaproject/corteza-server:${{ env.BUILD_VERSION_SHA }} \
-t ghcr.io/cortezaproject/corteza-server:${{ env.BUILD_VERSION_REF }} .
if: ${{ !env.ACT }}
- run: docker push ghcr.io/cortezaproject/corteza-server:${{ env.BUILD_VERSION_SHA }}
if: ${{ !env.ACT }}
- run: docker push ghcr.io/cortezaproject/corteza-server:${{ env.BUILD_VERSION_REF }}
if: ${{ !env.ACT }}