diff --git a/.github/workflows/apcd-cms.yml b/.github/workflows/apcd-cms.yml index fa3ac8a6..4b7d5643 100644 --- a/.github/workflows/apcd-cms.yml +++ b/.github/workflows/apcd-cms.yml @@ -1,10 +1,10 @@ -name: APCD CMS Builds +name: APCD CMS Builds on: workflow_dispatch: push: - branches: [ main ] + branches: [main] paths: - - 'apcd-cms/**' + - "apcd-cms/**" jobs: build_commit: @@ -13,29 +13,27 @@ jobs: run: working-directory: apcd-cms steps: - - uses: actions/checkout@v2 - - name: Get shortsha + - name: Checkout + uses: actions/checkout@v4 + + - name: Set shortsha and branch environment variables 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 - 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_OUTPUT"; + echo "SHORT_SHA=${GITHUB_SHA::7}" >> "$GITHUB_OUTPUT"; + + - 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 }} \ No newline at end of file + tags: taccwma/apcd-cms:${{ steps.vars.outputs.SHORT_SHA }},taccwma/apcd-cms:${{ steps.vars.outputs.BRANCH_NAME }}