Skip to content

Commit

Permalink
Artifact + Matrix - 1
Browse files Browse the repository at this point in the history
Added build and push to have latest image available in docker hub that is generated with updated YAML file.
Removed join repo from workflow dispatch.

Added artifact so that this can be used in case of push trigger event in admin-dash and public-dash repos with the help of the python script fetch_runID.py in those repos, to get the latest run_ID for a specific branch with the artifact.

Workflow dispatch would still use the input parameters which contains the latest timestamp tag.
  • Loading branch information
Mahadik, Mukul Chandrakant authored and Mahadik, Mukul Chandrakant committed May 2, 2024
1 parent acecf3e commit 776f0b9
Showing 1 changed file with 23 additions and 12 deletions.
35 changes: 23 additions & 12 deletions .github/workflows/image_build_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ name: docker image
# TODO: Change to master branch once changes are final.
on:
push:
branches: [ tags-matrix ]

branches: [ tags-combo-approach ]

# Env variable
env:
Expand Down Expand Up @@ -42,28 +41,40 @@ jobs:
run: echo running in repo ${GITHUB_REPOSITORY#*/} branch ${GITHUB_REF##*/} on ${{ steps.date.outputs.date }}

# Runs a set of commands using the runners shell
# - name: build docker image
# run: |
# docker build -t $DOCKER_USER/${GITHUB_REPOSITORY#*/}:${GITHUB_REF##*/}_${{ steps.date.outputs.date }} .
# docker images
- name: build docker image
run: |
docker build -t $DOCKER_USER/${GITHUB_REPOSITORY#*/}:${GITHUB_REF##*/}_${{ steps.date.outputs.date }} .
docker images
# - name: push docker image
# run: |
# docker push $DOCKER_USER/${GITHUB_REPOSITORY#*/}:${GITHUB_REF##*/}_${{ steps.date.outputs.date }}
- name: push docker image
run: |
docker push $DOCKER_USER/${GITHUB_REPOSITORY#*/}:${GITHUB_REF##*/}_${{ steps.date.outputs.date }}
- name: Create a text file
run: |
echo ${{ steps.date.outputs.date }} > tag_file.txt
echo "Created tag text file"
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: docker-image-tag
path: tag_file.txt
overwrite: true

dispatch:
needs: build
runs-on: ubuntu-latest

env:
DOCKER_IMAGE_TAG: ${{needs.build.outputs.date}}
DOCKER_IMAGE_TAG: ${{ needs.build.outputs.date }}

strategy:
matrix:
repo: ['MukuFlash03/nrel-openpath-join-page', 'MukuFlash03/op-admin-dashboard', 'MukuFlash03/em-public-dashboard']
repo: ['MukuFlash03/op-admin-dashboard', 'MukuFlash03/em-public-dashboard']

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Trigger workflow in join-page, admin-dash, public-dash
run: |
Expand Down

0 comments on commit 776f0b9

Please sign in to comment.