Skip to content

Commit 235bb3d

Browse files
authored
Update Sandbox.yml
1 parent b075fe5 commit 235bb3d

File tree

1 file changed

+26
-38
lines changed

1 file changed

+26
-38
lines changed

.github/workflows/Sandbox.yml

Lines changed: 26 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: QA-Prod
22

33
on:
44
workflow_dispatch: # used for QA Deployments
5-
push: # used for Prod/Stg image building
5+
push:
66
tags:
77
- 'sandbox-*'
88
- '[0-9]+.[0-9]+.[0-9]+'
@@ -13,48 +13,36 @@ jobs:
1313
contents: read
1414
pull-requests: write
1515
runs-on: ubuntu-latest
16+
1617
steps:
1718
- uses: actions/checkout@v3
19+
1820
- name: Set Docker Tag
1921
id: vars
20-
if: always()
2122
run: |
22-
REPOSITORY="sandbox-${GITHUB_REPOSITORY#*/}"
23-
echo ::set-output name=REPOSITORY::${REPOSITORY}
24-
25-
if [[ ${{ github.ref }} == refs/tags* ]]; then
26-
RAW_TAG=${GITHUB_REF#refs/tags/}
27-
VERSION_TAG=${RAW_TAG##*:}
28-
echo ::set-output name=TAG::${VERSION_TAG}
29-
echo ::set-output name=TARGET::${{ secrets.SLACK_WEBHOOK_PROD }}
30-
REPO_NAME="${RAW_TAG%%:*}"
31-
CLEAN_TAG="${RAW_TAG#sandbox-}"
32-
TAG="${REPO_NAME}:${CLEAN_TAG}"
33-
echo "Final Docker tag: $TAG"
34-
else
35-
TAG=qa-${GITHUB_SHA::7}-$(date +%s)
36-
echo ::set-output name=TAG::${TAG}
37-
echo ::set-output name=TARGET::${{ secrets.SLACK_WEBHOOK }}
38-
REPO_NAME="${RAW_TAG%%:*}"
39-
CLEAN_TAG="${RAW_TAG#sandbox-}"
40-
TAG="${REPO_NAME}:${CLEAN_TAG}"
41-
echo "Final Docker tag: $TAG"
42-
fi
43-
# - name: Clean Docker Tag
44-
# run: |
45-
# RAW_TAG="sandbox-adminer-core:sandbox-1.1.3"
46-
47-
# REPO_NAME="${RAW_TAG%%:*}"
48-
# TAG_NAME="${RAW_TAG#*:}"
49-
# CLEAN_TAG="${TAG_NAME#sandbox-}"
50-
51-
# FINAL_TAG="${REPO_NAME}:${CLEAN_TAG}"
52-
# echo "Final Docker tag: $FINAL_TAG"
53-
- name: Build the Docker image
23+
RAW_TAG="${GITHUB_REF#refs/tags/}"
24+
REPOSITORY="${RAW_TAG%%:*}"
25+
FULL_TAG="${RAW_TAG#*:}"
26+
CLEAN_TAG="${FULL_TAG#sandbox-}"
27+
28+
echo "REPOSITORY=$REPOSITORY"
29+
echo "CLEAN_TAG=$CLEAN_TAG"
30+
31+
echo "REPOSITORY=$REPOSITORY" >> $GITHUB_ENV
32+
echo "TAG=$CLEAN_TAG" >> $GITHUB_ENV
33+
echo "TARGET=${{ secrets.SLACK_WEBHOOK_PROD }}" >> $GITHUB_ENV
34+
35+
echo "::set-output name=REPOSITORY::$REPOSITORY"
36+
echo "::set-output name=TAG::$CLEAN_TAG"
37+
echo "::set-output name=TARGET::${{ secrets.SLACK_WEBHOOK_PROD }}"
38+
39+
- name: Build and Push Docker Image
5440
env:
5541
LLC_ECR_HOST: ${{ secrets.LLC_ECR_HOST }}
56-
TAG: ${{ steps.vars.outputs.TAG }}
57-
REPOSITORY: ${{ steps.vars.outputs.REPOSITORY }}
42+
REPOSITORY: ${{ env.REPOSITORY }}
43+
TAG: ${{ env.TAG }}
5844
run: |
59-
docker build . --file Dockerfile --tag ${LLC_ECR_HOST}/$REPOSITORY:$TAG
60-
docker push ${LLC_ECR_HOST}/$REPOSITORY:$TAG
45+
IMAGE=${LLC_ECR_HOST}/${REPOSITORY}:${TAG}
46+
echo "Building Docker image: $IMAGE"
47+
docker build . --file Dockerfile --tag "$IMAGE"
48+
docker push "$IMAGE"

0 commit comments

Comments
 (0)