Skip to content

Commit

Permalink
only push static tag for main
Browse files Browse the repository at this point in the history
  • Loading branch information
CubicrootXYZ committed Oct 20, 2024
1 parent 3ee8c8e commit 8aa96e4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build_image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ jobs:
if: "startsWith(github.ref, 'refs/tags/')"
run: docker push ${{ inputs.image_name }}:${{ github.ref_name }}
- name: Tag image with static tag
if: "${{ inputs.static_tag != '' }}"
if: "${{ inputs.static_tag != '' && github.ref == 'refs/heads/main'}}"
run: docker tag ${{ inputs.image_name }}:${{ github.sha }} ${{ inputs.image_name }}:${{ inputs.static_tag }}
- name: Push image with static tag
if: "${{ inputs.static_tag != '' }}"
if: "${{ inputs.static_tag != '' && github.ref == 'refs/heads/main'}}"
run: docker push ${{ inputs.image_name }}:${{ inputs.static_tag }}

2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Collection of commonly used GitHub workflows.

This workflow will build and push images to Dockerhub. For any change an image with the commit SHA as tag will be published. For releases the release tag will be used to tag the image.

Provide a `static_tag` so any commit on `main` branch will result in an image pushed with that tag. Can be used to provide a `beta` or `main` tagged image.

```yaml
jobs:
build_image:
Expand Down

0 comments on commit 8aa96e4

Please sign in to comment.