Skip to content

Commit

Permalink
make job react based on tags
Browse files Browse the repository at this point in the history
  • Loading branch information
ruanxin committed Sep 4, 2024
1 parent caa7ee4 commit bd0beeb
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/build-template-operator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
push:
branches:
- main # This will get tagged with `latest` and `v{{DATE}}-{{COMMIT_HASH_SHORT}}`
tags:
- '[0-9]+.[0-9]+.[0-9]+'
- '[0-9]+.[0-9]+.[0-9]+-*'
pull_request_target:
types: [ opened, edited, synchronize, reopened, ready_for_review ]

Expand All @@ -21,8 +24,12 @@ jobs:
uses: actions/checkout@v4
- name: Get the latest tag
id: get_tag
if: github.event_name == 'push'
run: echo "tag=latest" >> $GITHUB_OUTPUT
run: |
if [[ "${{ github.event_name }}" == "push" && "${{ github.ref_type }}" == "tag" ]]; then
echo "tag=${{ github.ref_name }}" >> $GITHUB_OUTPUT
elif [[ "${{ github.event_name }}" == "push" ]]; then
echo "tag=latest" >> $GITHUB_OUTPUT
fi
- name: Echo the tag
run: echo ${{ steps.get_tag.outputs.TAG }}
build-image:
Expand Down

0 comments on commit bd0beeb

Please sign in to comment.