From 70ab7f3b042548e98952f9f7095d6687f3e0cbc9 Mon Sep 17 00:00:00 2001 From: Andrew Date: Thu, 12 Sep 2024 12:16:25 -0400 Subject: [PATCH 1/4] try to check tag for minimal-app --- .github/workflows/minimal-app.yml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/workflows/minimal-app.yml b/.github/workflows/minimal-app.yml index e75459a..53426aa 100644 --- a/.github/workflows/minimal-app.yml +++ b/.github/workflows/minimal-app.yml @@ -42,10 +42,28 @@ jobs: distribution: "temurin" - run: mvn --batch-mode --update-snapshots verify name: build image + check_tag: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + - name: Check if tag exists + id: check_tag + run: | + version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) + tag_name=${{ env.GIT_TAG_PREFIX }}$version" >> "$GITHUB_OUTPUT" + if git rev-parse -q --verify "refs/tags/$tag_name" > /dev/null; then + echo "Tag exists" + echo "tag_exists=true" >> $GITHUB_ENV + else + echo "Tag does not exist" + echo "tag_exists=false" >> $GITHUB_ENV + fi release: - if: github.ref == 'refs/heads/main' + if: github.ref == 'refs/heads/main' && env.tag_exists == 'false' runs-on: ubuntu-latest + needs: check_tag defaults: run: shell: bash From 0e3bd0d41aed64d1d018e8adf142a01be3373701 Mon Sep 17 00:00:00 2001 From: Andrew Date: Thu, 12 Sep 2024 12:20:19 -0400 Subject: [PATCH 2/4] run conditionally when specific directories changed --- .github/workflows/minimal-app.yml | 5 ++--- .github/workflows/webhook.yml | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/minimal-app.yml b/.github/workflows/minimal-app.yml index 53426aa..f9d9ea5 100644 --- a/.github/workflows/minimal-app.yml +++ b/.github/workflows/minimal-app.yml @@ -8,10 +8,9 @@ on: - .github/workflows/minimal-app.yml push: branches: - - main + - successfully_release_nothing paths: - - operator/** - - "!operator/webhook/**" + - minimal-app/** env: WORKING_DIR: ./minimal-app diff --git a/.github/workflows/webhook.yml b/.github/workflows/webhook.yml index c7da718..787d88d 100644 --- a/.github/workflows/webhook.yml +++ b/.github/workflows/webhook.yml @@ -9,8 +9,7 @@ on: branches: - main paths: - - operator/** - - "!operator/webhook/**" + - operator/webhook/** env: WORKING_DIR: ./operator/webhook From 7b7db251c519fc9f83898c956ec73a32fb935044 Mon Sep 17 00:00:00 2001 From: Andrew Date: Thu, 12 Sep 2024 12:20:31 -0400 Subject: [PATCH 3/4] Revert "try to check tag for minimal-app" This reverts commit 70ab7f3b042548e98952f9f7095d6687f3e0cbc9. --- .github/workflows/minimal-app.yml | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/.github/workflows/minimal-app.yml b/.github/workflows/minimal-app.yml index f9d9ea5..5d2cdb1 100644 --- a/.github/workflows/minimal-app.yml +++ b/.github/workflows/minimal-app.yml @@ -41,28 +41,10 @@ jobs: distribution: "temurin" - run: mvn --batch-mode --update-snapshots verify name: build image - check_tag: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v3 - - name: Check if tag exists - id: check_tag - run: | - version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) - tag_name=${{ env.GIT_TAG_PREFIX }}$version" >> "$GITHUB_OUTPUT" - if git rev-parse -q --verify "refs/tags/$tag_name" > /dev/null; then - echo "Tag exists" - echo "tag_exists=true" >> $GITHUB_ENV - else - echo "Tag does not exist" - echo "tag_exists=false" >> $GITHUB_ENV - fi release: - if: github.ref == 'refs/heads/main' && env.tag_exists == 'false' + if: github.ref == 'refs/heads/main' runs-on: ubuntu-latest - needs: check_tag defaults: run: shell: bash From 7317ce95799a926d97aedcd13a02dc3aaa92cac3 Mon Sep 17 00:00:00 2001 From: Andrew Date: Thu, 12 Sep 2024 12:21:15 -0400 Subject: [PATCH 4/4] fix branch name --- .github/workflows/minimal-app.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/minimal-app.yml b/.github/workflows/minimal-app.yml index 5d2cdb1..62d771d 100644 --- a/.github/workflows/minimal-app.yml +++ b/.github/workflows/minimal-app.yml @@ -8,7 +8,7 @@ on: - .github/workflows/minimal-app.yml push: branches: - - successfully_release_nothing + - main paths: - minimal-app/**