Skip to content

Commit

Permalink
update apcd workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
rstijerina committed Nov 13, 2023
1 parent 0eb77f8 commit b30f1a9
Showing 1 changed file with 20 additions and 22 deletions.
42 changes: 20 additions & 22 deletions .github/workflows/apcd-cms.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
name: APCD CMS Builds
name: APCD CMS Builds
run-name: ${{ github.actor }} is building Docker Image for APCD CMS on branch ${{ github.actor }}
on:
workflow_dispatch:
push:
branches: [ main ]
branches: [main]
paths:
- 'apcd-cms/**'
- "apcd-cms/**"

jobs:
build_commit:
Expand All @@ -13,29 +14,26 @@ jobs:
run:
working-directory: apcd-cms
steps:
- uses: actions/checkout@v2
- name: Get shortsha
id: vars
run: |
if [ -z "$EVENT_SHA" ]; then SHORT_SHA=${GITHUB_SHA::8}; else SHORT_SHA=${EVENT_SHA::8}; fi
echo ::set-output name=sha_short::${SHORT_SHA}
env:
EVENT_SHA: ${{ github.event.client_payload.sha }}
- name: Print shortsha
- name: Checkout
uses: actions/checkout@v4

- name: Set shortsha and branch environment variables
run: |
echo $SHORTSHA
env:
SHORTSHA: ${{ steps.vars.outputs.sha_short }}
- uses: docker/setup-buildx-action@v2
name: Setup Docker Builds
- uses: docker/login-action@v2
name: Log in to docker
echo "BRANCH_NAME=$(echo ${GITHUB_REF_NAME} | sed 's/[^[:alnum:]\.\_\-]/-/g')" >> "$GITHUB_ENV";
echo "SHORT_SHA=${GITHUB_SHA::7}" >> "$GITHUB_ENV";
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: docker/build-push-action@v3
name: Build & push commit tagged Docker image

- name: Build & push commit tagged Docker image
uses: docker/build-push-action@v5
with:
context: apcd-cms
push: true
tags: taccwma/apcd-cms:${{ steps.vars.outputs.sha_short }}
tags: taccwma/apcd-cms:$SHORT_SHA,taccwma/apcd-cms:$BRANCH_NAME

0 comments on commit b30f1a9

Please sign in to comment.