From 21a3f2f3b7ab64774973c853b8f9ab460c59aa42 Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 27 May 2024 14:48:10 -0600 Subject: [PATCH] Update ci.yml parens around if statement to only run releases on master. git fetch --tags before requesting next tag --- .github/workflows/ci.yml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aa7fa1fc..e501e35a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -82,14 +82,12 @@ jobs: # Increments to the next tag on master only, bumps version based on the recent commits new_tag: - if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' && github.event_name == 'push' + if: (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') && github.event_name == 'push' runs-on: ubuntu-latest needs: test steps: - name: Checkout code uses: actions/checkout@v4 - with: - fetch-depth: 0 - name: Set up Go uses: actions/setup-go@v5 with: @@ -97,6 +95,7 @@ jobs: - name: Get next version id: new_git_tag run: | + git fetch --tags go install github.com/caarlos0/svu@latest NEW_TAG=$(svu next --force-patch-increment) echo "Using the next tag of ${NEW_TAG} for this release" @@ -107,7 +106,7 @@ jobs: # Creates a new release page on GitHub when master changes create_release: - if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' && github.event_name == 'push' + if: (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') && github.event_name == 'push' runs-on: ubuntu-latest needs: new_tag steps: @@ -129,7 +128,7 @@ jobs: # In this Release section, we are re-building the binaries because eventually we can include the new git tag as their # version string when saying 'colly --version' build_and_upload: - if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' && github.event_name == 'push' + if: (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') && github.event_name == 'push' runs-on: ubuntu-latest needs: [test, new_tag, create_release] strategy: @@ -164,8 +163,6 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 - with: - fetch-depth: 0 - name: Set up Go uses: actions/setup-go@v5 with: