From 17dd86926f1378a7e2156dbe06997afc818e3cb1 Mon Sep 17 00:00:00 2001 From: Manuel Hutter Date: Mon, 2 Dec 2024 14:26:19 +0100 Subject: [PATCH 1/3] chore(ci): Normalize YAML Signed-off-by: Manuel Hutter --- .github/workflows/lint.yml | 30 ++++++------- .github/workflows/master.yml | 42 +++++++++--------- .github/workflows/release.yml | 82 +++++++++++++++++------------------ .github/workflows/test.yml | 36 +++++++-------- 4 files changed, 95 insertions(+), 95 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index b9d7e4b..1c0abc4 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -4,23 +4,23 @@ on: pull_request: {} push: branches: - - master + - master jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Determine Go version from go.mod - run: echo "GO_VERSION=$(grep "go 1." go.mod | cut -d " " -f 2)" >> $GITHUB_ENV - - uses: actions/setup-go@v2 - with: - go-version: ${{ env.GO_VERSION }} - - uses: actions/cache@v2 - with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- - - name: Run linters - run: make lint + - uses: actions/checkout@v2 + - name: Determine Go version from go.mod + run: echo "GO_VERSION=$(grep "go 1." go.mod | cut -d " " -f 2)" >> $GITHUB_ENV + - uses: actions/setup-go@v2 + with: + go-version: ${{ env.GO_VERSION }} + - uses: actions/cache@v2 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + - name: Run linters + run: make lint diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index d40ce75..491e62e 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -3,29 +3,29 @@ name: Master on: push: branches: - - master + - master jobs: dist: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Determine Go version from go.mod - run: echo "GO_VERSION=$(grep "go 1." go.mod | cut -d " " -f 2)" >> $GITHUB_ENV - - uses: actions/setup-go@v2 - with: - go-version: ${{ env.GO_VERSION }} - - uses: actions/cache@v2 - with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- - - name: Build docker images - run: make docker-build -e IMG_TAG=${GITHUB_REF#refs/heads/} - - name: Login to Docker hub - run: docker login -u "${{ secrets.DOCKER_HUB_USER }}" -p "${{ secrets.DOCKER_HUB_PASSWORD }}" - - name: Login to quay.io - run: docker login -u "${{ secrets.QUAY_IO_USER }}" -p "${{ secrets.QUAY_IO_PASSWORD }}" quay.io - - name: Push docker images - run: make docker-push -e IMG_TAG=${GITHUB_REF#refs/heads/} + - uses: actions/checkout@v2 + - name: Determine Go version from go.mod + run: echo "GO_VERSION=$(grep "go 1." go.mod | cut -d " " -f 2)" >> $GITHUB_ENV + - uses: actions/setup-go@v2 + with: + go-version: ${{ env.GO_VERSION }} + - uses: actions/cache@v2 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + - name: Build docker images + run: make docker-build -e IMG_TAG=${GITHUB_REF#refs/heads/} + - name: Login to Docker hub + run: docker login -u "${{ secrets.DOCKER_HUB_USER }}" -p "${{ secrets.DOCKER_HUB_PASSWORD }}" + - name: Login to quay.io + run: docker login -u "${{ secrets.QUAY_IO_USER }}" -p "${{ secrets.QUAY_IO_PASSWORD }}" quay.io + - name: Push docker images + run: make docker-push -e IMG_TAG=${GITHUB_REF#refs/heads/} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 67af10c..f311352 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,49 +3,49 @@ name: Release on: push: tags: - - "*" + - "*" jobs: dist: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Determine Go version from go.mod - run: echo "GO_VERSION=$(grep "go 1." go.mod | cut -d " " -f 2)" >> $GITHUB_ENV - - uses: actions/setup-go@v2 - with: - go-version: ${{ env.GO_VERSION }} - - uses: actions/cache@v2 - with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- - - name: Import GPG signing key - uses: crazy-max/ghaction-import-gpg@v4 - with: - gpg_private_key: ${{ secrets.SIGNING_KEY }} - - name: Login to Docker hub - run: docker login -u "${{ secrets.DOCKER_HUB_USER }}" -p "${{ secrets.DOCKER_HUB_PASSWORD }}" - - name: Login to quay.io - run: docker login -u "${{ secrets.QUAY_IO_USER }}" -p "${{ secrets.QUAY_IO_PASSWORD }}" quay.io - - name: Build changelog from PRs with labels - id: build_changelog - uses: mikepenz/release-changelog-builder-action@v2 - with: - configuration: ".github/changelog-configuration.json" - # PreReleases still get a changelog, but the next full release gets a diff since the last full release, - # combining possible changelogs of all previous PreReleases in between. PreReleases show a partial changelog - # since last PreRelease. - ignorePreReleases: "${{ !contains(github.ref, '-rc') }}" - outputFile: .github/release-notes.md - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Publish releases - uses: goreleaser/goreleaser-action@v2 - with: - args: release --release-notes .github/release-notes.md - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Determine Go version from go.mod + run: echo "GO_VERSION=$(grep "go 1." go.mod | cut -d " " -f 2)" >> $GITHUB_ENV + - uses: actions/setup-go@v2 + with: + go-version: ${{ env.GO_VERSION }} + - uses: actions/cache@v2 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + - name: Import GPG signing key + uses: crazy-max/ghaction-import-gpg@v4 + with: + gpg_private_key: ${{ secrets.SIGNING_KEY }} + - name: Login to Docker hub + run: docker login -u "${{ secrets.DOCKER_HUB_USER }}" -p "${{ secrets.DOCKER_HUB_PASSWORD }}" + - name: Login to quay.io + run: docker login -u "${{ secrets.QUAY_IO_USER }}" -p "${{ secrets.QUAY_IO_PASSWORD }}" quay.io + - name: Build changelog from PRs with labels + id: build_changelog + uses: mikepenz/release-changelog-builder-action@v2 + with: + configuration: ".github/changelog-configuration.json" + # PreReleases still get a changelog, but the next full release gets a diff since the last full release, + # combining possible changelogs of all previous PreReleases in between. PreReleases show a partial changelog + # since last PreRelease. + ignorePreReleases: "${{ !contains(github.ref, '-rc') }}" + outputFile: .github/release-notes.md + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Publish releases + uses: goreleaser/goreleaser-action@v2 + with: + args: release --release-notes .github/release-notes.md + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e7f9fb7..82be67f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,28 +3,28 @@ name: Test on: push: branches: - - master + - master pull_request: branches: - - master + - master jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Determine Go version from go.mod - run: echo "GO_VERSION=$(grep "go 1." go.mod | cut -d " " -f 2)" >> $GITHUB_ENV - - uses: actions/setup-go@v2 - with: - go-version: ${{ env.GO_VERSION }} - - uses: actions/cache@v2 - with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- - - name: Run tests - run: make test + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Determine Go version from go.mod + run: echo "GO_VERSION=$(grep "go 1." go.mod | cut -d " " -f 2)" >> $GITHUB_ENV + - uses: actions/setup-go@v2 + with: + go-version: ${{ env.GO_VERSION }} + - uses: actions/cache@v2 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + - name: Run tests + run: make test From 1e253214be1da07827d5208fdebb3772845d6b04 Mon Sep 17 00:00:00 2001 From: Manuel Hutter Date: Mon, 2 Dec 2024 14:26:57 +0100 Subject: [PATCH 2/3] chore(ci): Bump actions/checkout to v4 Signed-off-by: Manuel Hutter --- .github/workflows/lint.yml | 2 +- .github/workflows/master.yml | 2 +- .github/workflows/release.yml | 2 +- .github/workflows/test.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 1c0abc4..3ce8e76 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -10,7 +10,7 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Determine Go version from go.mod run: echo "GO_VERSION=$(grep "go 1." go.mod | cut -d " " -f 2)" >> $GITHUB_ENV - uses: actions/setup-go@v2 diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index 491e62e..a3cb52a 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -9,7 +9,7 @@ jobs: dist: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Determine Go version from go.mod run: echo "GO_VERSION=$(grep "go 1." go.mod | cut -d " " -f 2)" >> $GITHUB_ENV - uses: actions/setup-go@v2 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f311352..dfb4675 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,7 +9,7 @@ jobs: dist: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Determine Go version from go.mod diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 82be67f..ade990d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,7 +12,7 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Determine Go version from go.mod From 405d80bcc8f3d6f06cac9d1b4a1ebf28d8664e8f Mon Sep 17 00:00:00 2001 From: Manuel Hutter Date: Mon, 2 Dec 2024 14:29:39 +0100 Subject: [PATCH 3/3] chore(ci): Bump actions/setup-go to v5 This obsoletes the following steps: - manually determining the desired Go version from `go.mod` - manually configuring caching since the latest version of `actions/setup-go` can do that itself. Signed-off-by: Manuel Hutter --- .github/workflows/lint.yml | 12 ++---------- .github/workflows/master.yml | 12 ++---------- .github/workflows/release.yml | 12 ++---------- .github/workflows/test.yml | 12 ++---------- 4 files changed, 8 insertions(+), 40 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 3ce8e76..945e49c 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -11,16 +11,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Determine Go version from go.mod - run: echo "GO_VERSION=$(grep "go 1." go.mod | cut -d " " -f 2)" >> $GITHUB_ENV - - uses: actions/setup-go@v2 + - uses: actions/setup-go@v5 with: - go-version: ${{ env.GO_VERSION }} - - uses: actions/cache@v2 - with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- + go-version-file: go.mod - name: Run linters run: make lint diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index a3cb52a..df0bf3f 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -10,17 +10,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Determine Go version from go.mod - run: echo "GO_VERSION=$(grep "go 1." go.mod | cut -d " " -f 2)" >> $GITHUB_ENV - - uses: actions/setup-go@v2 + - uses: actions/setup-go@v5 with: - go-version: ${{ env.GO_VERSION }} - - uses: actions/cache@v2 - with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- + go-version-file: go.mod - name: Build docker images run: make docker-build -e IMG_TAG=${GITHUB_REF#refs/heads/} - name: Login to Docker hub diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index dfb4675..efa965d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,17 +12,9 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Determine Go version from go.mod - run: echo "GO_VERSION=$(grep "go 1." go.mod | cut -d " " -f 2)" >> $GITHUB_ENV - - uses: actions/setup-go@v2 + - uses: actions/setup-go@v5 with: - go-version: ${{ env.GO_VERSION }} - - uses: actions/cache@v2 - with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- + go-version-file: go.mod - name: Import GPG signing key uses: crazy-max/ghaction-import-gpg@v4 with: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ade990d..45c9efa 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,16 +15,8 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Determine Go version from go.mod - run: echo "GO_VERSION=$(grep "go 1." go.mod | cut -d " " -f 2)" >> $GITHUB_ENV - - uses: actions/setup-go@v2 + - uses: actions/setup-go@v5 with: - go-version: ${{ env.GO_VERSION }} - - uses: actions/cache@v2 - with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- + go-version-file: go.mod - name: Run tests run: make test