From 888fab66dae1b0312e1be54929197e0718e182b3 Mon Sep 17 00:00:00 2001 From: Jozef Kralik Date: Thu, 18 Jan 2024 16:11:03 +0000 Subject: [PATCH 1/3] Update GitHub actions actions/setup-go: v4 -> v5 actions/upload-artifact: v3 -> v4 goreleaser/goreleaser-action: v4 -> v5 go-version: ^1.18 -> ^1.20 --- .github/workflows/build-publish.yaml | 5 ++++ .github/workflows/buildTestBinaries.yml | 9 +++++-- .github/workflows/checkFormat.yml | 7 ++++- .github/workflows/golangci-lint.yml | 8 +++++- .github/workflows/release.yml | 35 ++++++++++++++++++++----- .github/workflows/staticAnalysis.yml | 7 ++++- .github/workflows/test.yml | 7 ++++- 7 files changed, 66 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build-publish.yaml b/.github/workflows/build-publish.yaml index d2b74806..a13067d3 100644 --- a/.github/workflows/build-publish.yaml +++ b/.github/workflows/build-publish.yaml @@ -6,6 +6,11 @@ on: pull_request: branches: - main + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.ref_name != 'main' }} env: REGISTRY: ghcr.io diff --git a/.github/workflows/buildTestBinaries.yml b/.github/workflows/buildTestBinaries.yml index 7c87d9aa..9e279dd7 100644 --- a/.github/workflows/buildTestBinaries.yml +++ b/.github/workflows/buildTestBinaries.yml @@ -8,6 +8,11 @@ on: branches: - main pull_request: + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.ref_name != 'main' }} # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: @@ -23,7 +28,7 @@ jobs: with: fetch-depth: 0 submodules: true - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "^1.20" # The Go version to download (if necessary) and use. @@ -45,7 +50,7 @@ jobs: UI_FILE: ${{ steps.vars.outputs.ui_file }} - name: Upload assets - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: client_application-${{ steps.vars.outputs.version }} path: | diff --git a/.github/workflows/checkFormat.yml b/.github/workflows/checkFormat.yml index ab8b88aa..45360e64 100644 --- a/.github/workflows/checkFormat.yml +++ b/.github/workflows/checkFormat.yml @@ -5,6 +5,11 @@ on: pull_request: branches: - main + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.ref_name != 'main' }} jobs: format: @@ -15,7 +20,7 @@ jobs: with: # fetch branches and history so `git merge-base` in check-format-on-diff works correctly fetch-depth: 0 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "^1.20" # The Go version to download (if necessary) and use. diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index a693a4e8..ddea2c26 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -9,13 +9,19 @@ on: pull_request: branches: - main + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.ref_name != 'main' }} + jobs: golangci: name: lint runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "^1.20" # The Go version to download (if necessary) and use. - run: go version diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8516c574..6b85aba7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,9 +2,17 @@ name: goreleaser on: push: - # run only against tags + branches: + - main tags: - - '*' + # Create a release on a tag push + - "*" + pull_request: + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.ref_name != 'main' }} permissions: contents: write @@ -26,7 +34,7 @@ jobs: run: git fetch --force --tags - name: Set up Go - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: go-version: 1.20 @@ -34,9 +42,24 @@ jobs: id: vars run: | echo "ui_file=$(pwd)/.tmp/ui.tar.gz" >> $GITHUB_OUTPUT - - - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v4 + + - name: Dry-run GoReleaser + if: ${{ github.ref_type != 'tag' }} + uses: goreleaser/goreleaser-action@v5 + with: + # either 'goreleaser' (default) or 'goreleaser-pro' + distribution: goreleaser + version: latest + args: release --rm-dist --skip-validate --skip-publish + env: + UI_SEPARATOR: "--------UI--------" + UI_FILE: ${{ steps.vars.outputs.ui_file }} + # Your GoReleaser Pro key, if you are using the 'goreleaser-pro' distribution + # GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} + + - name: Run GoReleaser + if: ${{ github.ref_type == 'tag' }} + uses: goreleaser/goreleaser-action@v5 with: # either 'goreleaser' (default) or 'goreleaser-pro' distribution: goreleaser diff --git a/.github/workflows/staticAnalysis.yml b/.github/workflows/staticAnalysis.yml index f790ff71..a59289ae 100644 --- a/.github/workflows/staticAnalysis.yml +++ b/.github/workflows/staticAnalysis.yml @@ -5,6 +5,11 @@ on: pull_request: branches: - main + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.ref_name != 'main' }} jobs: analysis: @@ -12,7 +17,7 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "^1.20" # The Go version to download (if necessary) and use. - run: go version diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fc48a560..9d893f02 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,6 +10,11 @@ on: tags: - "*" pull_request: + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.ref_name != 'main' }} # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: @@ -23,7 +28,7 @@ jobs: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "^1.20" # The Go version to download (if necessary) and use. From 6bc8f9c61e7d980511ff47ea519dd39767c46e9c Mon Sep 17 00:00:00 2001 From: Jozef Kralik Date: Fri, 19 Jan 2024 07:12:54 +0000 Subject: [PATCH 2/3] print go version and supported platforms --- .github/workflows/release.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6b85aba7..3c615b69 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -32,12 +32,18 @@ jobs: - name: Fetch all tags run: git fetch --force --tags - - - name: Set up Go + + - name: Set up Go uses: actions/setup-go@v5 with: go-version: 1.20 + - name: Print Go version + run: go version + + - name: Print supported platforms + run: go tool dist list + - name: Set ui_file id: vars run: | From 842c5dfd63075e4e090b6dcaf1e045979a660ae3 Mon Sep 17 00:00:00 2001 From: Jozef Kralik Date: Fri, 19 Jan 2024 07:22:30 +0000 Subject: [PATCH 3/3] use latest go --- .github/workflows/buildTestBinaries.yml | 1 + .github/workflows/checkFormat.yml | 1 + .github/workflows/golangci-lint.yml | 1 + .github/workflows/release.yml | 26 ++++++++++--------------- .github/workflows/staticAnalysis.yml | 1 + .github/workflows/test.yml | 1 + 6 files changed, 15 insertions(+), 16 deletions(-) diff --git a/.github/workflows/buildTestBinaries.yml b/.github/workflows/buildTestBinaries.yml index 9e279dd7..f1012257 100644 --- a/.github/workflows/buildTestBinaries.yml +++ b/.github/workflows/buildTestBinaries.yml @@ -31,6 +31,7 @@ jobs: - uses: actions/setup-go@v5 with: go-version: "^1.20" # The Go version to download (if necessary) and use. + check-latest: true - name: Set version and ui_file id: vars diff --git a/.github/workflows/checkFormat.yml b/.github/workflows/checkFormat.yml index 45360e64..232cf2a1 100644 --- a/.github/workflows/checkFormat.yml +++ b/.github/workflows/checkFormat.yml @@ -23,6 +23,7 @@ jobs: - uses: actions/setup-go@v5 with: go-version: "^1.20" # The Go version to download (if necessary) and use. + check-latest: true - name: Check formatting shell: bash diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index ddea2c26..a7893865 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -24,6 +24,7 @@ jobs: - uses: actions/setup-go@v5 with: go-version: "^1.20" # The Go version to download (if necessary) and use. + check-latest: true - run: go version - name: golangci-lint uses: golangci/golangci-lint-action@v3 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3c615b69..f603df34 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -36,7 +36,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: 1.20 + go-version: "1.20" - name: Print Go version run: go version @@ -49,28 +49,22 @@ jobs: run: | echo "ui_file=$(pwd)/.tmp/ui.tar.gz" >> $GITHUB_OUTPUT - - name: Dry-run GoReleaser - if: ${{ github.ref_type != 'tag' }} - uses: goreleaser/goreleaser-action@v5 - with: - # either 'goreleaser' (default) or 'goreleaser-pro' - distribution: goreleaser - version: latest - args: release --rm-dist --skip-validate --skip-publish - env: - UI_SEPARATOR: "--------UI--------" - UI_FILE: ${{ steps.vars.outputs.ui_file }} - # Your GoReleaser Pro key, if you are using the 'goreleaser-pro' distribution - # GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} + - name: Set args for goreleaser + id: args + run: | + if ${{ github.ref_type == 'tag' }} ; then + echo "args=release --rm-dist" >> $GITHUB_OUTPUT + else + echo "args=release --rm-dist --skip-validate --skip-publish" >> $GITHUB_OUTPUT + fi - name: Run GoReleaser - if: ${{ github.ref_type == 'tag' }} uses: goreleaser/goreleaser-action@v5 with: # either 'goreleaser' (default) or 'goreleaser-pro' distribution: goreleaser version: latest - args: release --rm-dist + args: ${{ steps.args.outputs.args }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} UI_SEPARATOR: "--------UI--------" diff --git a/.github/workflows/staticAnalysis.yml b/.github/workflows/staticAnalysis.yml index a59289ae..0f788b6f 100644 --- a/.github/workflows/staticAnalysis.yml +++ b/.github/workflows/staticAnalysis.yml @@ -20,6 +20,7 @@ jobs: - uses: actions/setup-go@v5 with: go-version: "^1.20" # The Go version to download (if necessary) and use. + check-latest: true - run: go version - name: Run go vet diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9d893f02..7c6d077d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -31,6 +31,7 @@ jobs: - uses: actions/setup-go@v5 with: go-version: "^1.20" # The Go version to download (if necessary) and use. + check-latest: true - name: Run a test run: make test