Skip to content

Commit

Permalink
Merge pull request #22 from vub-hpc/dispatch
Browse files Browse the repository at this point in the history
also support workflow dispatch
  • Loading branch information
lexming authored Jan 29, 2024
2 parents 5c34e66 + d1ff4a4 commit 88d9b8e
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions .github/workflows/build-publish-containers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@ jobs:
- name: Fix image date tag
run: |
echo IMAGE_TAG=$(date +"%Y%m%d") >> $GITHUB_ENV
- name: Check if we should publish
if: >-
(github.event_name == 'push' ||
github.event_name == 'schedule' ||
github.event_name == 'workflow_dispatch') &&
github.ref_name == 'main'
run: |
echo PUBLISH_IMAGES=1 >> $GITHUB_ENV
- name: Determine latest release of VSTS Agent
if: matrix.tag == 'azure-pipelines-azureagent'
Expand Down Expand Up @@ -60,9 +69,12 @@ jobs:
dockerfiles: |
./${{ matrix.tag }}/Dockerfile
- name: Print image name and tags
run: echo "Image ${{ steps.build-image.outputs.image }} build with tags ${{ steps.build-image.outputs.tags }}" >> $GITHUB_STEP_SUMMARY

- name: Publish image on ghcr.io
id: push-to-ghcr
if: (github.event_name == 'schedule' || github.event_name == 'push') && github.ref_name == 'main'
if: env.PUBLISH_IMAGES
uses: redhat-actions/[email protected]
with:
image: ${{ steps.build-image.outputs.image }}
Expand All @@ -71,9 +83,6 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Print image name and tags
run: echo "Image ${{ steps.build-image.outputs.image }} build with tags ${{ steps.build-image.outputs.tags }}" >> $GITHUB_STEP_SUMMARY

- name: Print image url
if: (github.event_name == 'schedule' || github.event_name == 'push') && github.ref_name == 'main'
if: env.PUBLISH_IMAGES
run: echo "Image pushed to ${{ steps.push-to-ghcr.outputs.registry-paths }}" >> $GITHUB_STEP_SUMMARY

0 comments on commit 88d9b8e

Please sign in to comment.