From 16a4b9a26303fc96a2fdb5b91bfbf3c0bcd30ce4 Mon Sep 17 00:00:00 2001 From: Harold Dost Date: Mon, 20 Dec 2021 23:35:11 +0100 Subject: [PATCH 1/2] Modify TestFile --- testfile.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/testfile.txt b/testfile.txt index e69de29..4993cb6 100644 --- a/testfile.txt +++ b/testfile.txt @@ -0,0 +1 @@ +Test the change From 3315b993e4da9b4934eea48156ae86c89bddfc03 Mon Sep 17 00:00:00 2001 From: Harold Dost Date: Mon, 20 Dec 2021 23:50:04 +0100 Subject: [PATCH 2/2] Test the workflow --- .github/workflows/ci-goreleaser.yaml | 34 +++++++++++++++++----------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci-goreleaser.yaml b/.github/workflows/ci-goreleaser.yaml index 65275ff..39937d8 100644 --- a/.github/workflows/ci-goreleaser.yaml +++ b/.github/workflows/ci-goreleaser.yaml @@ -1,33 +1,41 @@ -name: Continuous Integration - GoReleaser +name: Continuous Integration - Test File on: push: branches: [main] - paths: [".goreleaser.yaml"] pull_request: branches: [main] - paths: [".goreleaser.yaml"] jobs: + file-changed: + name: Did the file change + runs-on: ubuntu-20.04 + outputs: + changed: ${{ steps.file-check.outputs.changed }} + steps: + - name: Checkout + uses: actions/checkout@v2 + - id: file-check + name: Check for the file change + continue-on-error: true + run: | + git diff --quiet main..HEAD -- testfile.txt + echo "::setoutput changed=${?}" check-goreleaser: - name: Check GoReleaser Configuration + needs: file-changed + name: Check Tested File runs-on: ubuntu-20.04 steps: - name: Checkout uses: actions/checkout@v2 with: fetch-depth: 0 - - - name: Set up Go - uses: actions/setup-go@v2 - with: - go-version: 1.17 - - - name: Generate the sources - run: make generate-sources - - name: Run GoReleaser uses: goreleaser/goreleaser-action@v2 + if: ${{ needs.file-changed.outputs.changed == '1' }} with: version: latest args: --snapshot --rm-dist --timeout 1h + - name: Skip Check + if: ${{ needs.file-changed.outputs.changed == '0' }} + run: echo "Nothing to see here"