Fixes #1478
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Mantleplace - CI | |
on: | |
push: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Setup docker builder | |
uses: docker/setup-buildx-action@v1 | |
with: { install: true } | |
- name: set GitHub short sha | |
run: | | |
echo $GITHUB_SHA | head -c 8 | |
echo "GITHUB_SHA_SHORT=$(echo $GITHUB_SHA | head -c 8)" >> $GITHUB_ENV | |
- name: Test sbt dist | |
uses: docker/build-push-action@v2 | |
if: ${{ !(github.ref_type == 'tag' || (github.ref_type == 'branch' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' || github.ref == 'refs/heads/staging'))) }} | |
with: | |
target: build | |
push: false | |
cache-from: type=gha | |
build-args: | | |
APP_VERSION=${{ env.GITHUB_SHA_SHORT }} | |
- name: Test sbt dist (cached) | |
uses: docker/build-push-action@v2 | |
if: ${{ github.ref_type == 'tag' || (github.ref_type == 'branch' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' || github.ref == 'refs/heads/staging')) }} | |
with: | |
target: build | |
push: false | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
build-args: | | |
APP_VERSION=${{ env.GITHUB_SHA_SHORT }} | |
- name: Prepare production release tags | |
id: meta | |
uses: docker/metadata-action@v3 | |
if: ${{ github.ref_type == 'tag' }} | |
with: | |
images: | | |
assetmantle/mantleplace | |
tags: | | |
type=raw,value=latest-{{sha}}-{{date 'X'}} | |
type=raw,value=latest | |
- name: Prepare staging release ragas | |
id: meta-branch | |
uses: docker/metadata-action@v3 | |
if: ${{ github.ref_type == 'branch' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') }} | |
with: | |
images: | | |
assetmantle/mantleplace | |
tags: | | |
type=raw,value=edge-{{sha}}-{{date 'X'}} | |
type=raw,value=edge | |
- name: Prepare staging2 release ragas | |
id: meta-staging | |
uses: docker/metadata-action@v3 | |
if: ${{ github.ref_type == 'branch' && (github.ref == 'refs/heads/staging') }} | |
with: | |
images: | | |
assetmantle/mantleplace | |
tags: | | |
type=raw,value=staging-{{sha}}-{{date 'X'}} | |
type=raw,value=staging | |
- name: Login to docker registry | |
uses: docker/login-action@v1 | |
if: ${{ github.ref_type == 'tag' || (github.ref_type == 'branch' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' || github.ref == 'refs/heads/staging')) }} | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build production container image | |
uses: docker/build-push-action@v2 | |
if: ${{ github.ref_type == 'tag' }} | |
with: | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
build-args: | | |
APP_VERSION=${{ env.GITHUB_SHA_SHORT }} | |
- name: Build staging container image | |
uses: docker/build-push-action@v2 | |
if: ${{ github.ref_type == 'branch' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') }} | |
with: | |
push: true | |
tags: ${{ steps.meta-branch.outputs.tags }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
build-args: | | |
APP_VERSION=${{ env.GITHUB_SHA_SHORT }} | |
- name: Build staging2 container image | |
uses: docker/build-push-action@v2 | |
if: ${{ github.ref_type == 'branch' && (github.ref == 'refs/heads/staging') }} | |
with: | |
push: true | |
tags: ${{ steps.meta-staging.outputs.tags }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
build-args: | | |
APP_VERSION=${{ env.GITHUB_SHA_SHORT }} |