Skip to content

Update Sandbox.yml

Update Sandbox.yml #4

Workflow file for this run

name: QA-Prod
on:
workflow_dispatch: # used for QA Deployments
push: # used for Prod/Stg image building
tags:
- 'sandbox-*'
- '[0-9]+.[0-9]+.[0-9]+'
jobs:
build:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set Docker Tag
id: vars
if: always()
run: |
REPOSITORY="sandbox-${GITHUB_REPOSITORY#*/}"
echo ::set-output name=REPOSITORY::${REPOSITORY}
if [[ ${{ github.ref }} == refs/tags* ]]; then
RAW_TAG=${GITHUB_REF#refs/tags/}
VERSION_TAG=${RAW_TAG##*:} # This strips 'sandbox-repository:' and keeps '1.1.1'
echo ::set-output name=TAG::${VERSION_TAG}
echo ::set-output name=TARGET::${{ secrets.SLACK_WEBHOOK_PROD }}
else
TAG=qa-${GITHUB_SHA::7}-$(date +%s)
echo ::set-output name=TAG::${TAG}
echo ::set-output name=TARGET::${{ secrets.SLACK_WEBHOOK }}
fi
- name: Clean Docker Tag
run: |
RAW_TAG="sandbox-adminer-core:sandbox-1.1.3"
REPO_NAME="${RAW_TAG%%:*}"
TAG_NAME="${RAW_TAG#*:}"
CLEAN_TAG="${TAG_NAME#sandbox-}"
FINAL_TAG="${REPO_NAME}:${CLEAN_TAG}"
echo "Final Docker tag: $FINAL_TAG"
- name: Build the Docker image
env:
LLC_ECR_HOST: ${{ secrets.LLC_ECR_HOST }}
TAG: ${{ steps.vars.outputs.TAG }}
REPOSITORY: ${{ steps.vars.outputs.REPOSITORY }}
run: |
docker build . --file Dockerfile --tag ${LLC_ECR_HOST}/$REPOSITORY:$FINAL_TAG
docker push ${LLC_ECR_HOST}/$REPOSITORY:$FINAL_TAG