From dfe6ce7c2438e11d45f24a56ffb0e0cb576c37a9 Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Wed, 26 Apr 2023 18:21:55 +0100 Subject: [PATCH 1/3] refactor(release-please): minor tweak to config structure --- release-please-config.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/release-please-config.json b/release-please-config.json index a7992a5..01f3093 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -1,10 +1,10 @@ { - "release-type": "go", - "bump-minor-pre-major": true, - "bump-patch-for-minor-pre-major": true, "packages": { ".": { + "release-type": "go", "changelog-path": "CHANGELOG.md", + "bump-minor-pre-major": true, + "bump-patch-for-minor-pre-major": true, "draft": false, "prerelease": false, "extra-files": [ @@ -13,4 +13,4 @@ } }, "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json" -} \ No newline at end of file +} From 37bcb9991718fe03de973818d43acd3f5426f8fb Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Wed, 26 Apr 2023 18:24:38 +0100 Subject: [PATCH 2/3] ci(release): improve release-please and release jobs --- .github/workflows/ci.yml | 40 +++++++++++++++++++++--------------- .goreleaser.yml | 44 ++++++++++++++++++++-------------------- 2 files changed, 46 insertions(+), 38 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6044561..9323061 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 + - uses: actions/setup-go@v4 with: go-version: 1.19 - name: Install dependencies @@ -27,46 +27,54 @@ jobs: - uses: actions/checkout@v3 - uses: azure/setup-helm@v3 with: - token: "${{ secrets.GITHUB_TOKEN }}" + token: ${{ secrets.GITHUB_TOKEN }} - name: Lint chart run: helm lint chart - name: Template chart run: helm template chart release-please: + name: Release Please runs-on: ubuntu-latest - needs: [build, helm-lint] if: github.ref == 'refs/heads/main' + outputs: + release_created: ${{ steps.release-please.outputs.release_created }} + tag_name: ${{ steps.release-please.outputs.tag_name }} # e.g. v1.0.0 + version: ${{ steps.release-please.outputs.version }} # e.g. 1.0.0 + all: ${{ toJSON(steps.release-please.outputs) }} steps: - uses: google-github-actions/release-please-action@v3 id: release-please with: command: manifest - - if: ${{ steps.release-please.outputs.release_created }} - uses: actions/checkout@v3 + + release: + runs-on: ubuntu-latest + needs: [build, helm-lint, release-please] + if: needs.release-please.outputs.release_created + steps: + - uses: actions/checkout@v3 with: fetch-depth: 0 - - if: ${{ steps.release-please.outputs.release_created }} - name: Set up QEMU + - run: git fetch --force --tags + - name: Set up QEMU uses: docker/setup-qemu-action@v2 - - if: ${{ steps.release-please.outputs.release_created }} - uses: docker/setup-buildx-action@v2 - - if: ${{ steps.release-please.outputs.release_created }} - name: Docker Login + - uses: docker/setup-buildx-action@v2 + - name: Docker Login uses: docker/login-action@v2 with: registry: ghcr.io - username: ${{ github.repository_owner }} + username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - if: ${{ steps.release-please.outputs.release_created }} - uses: actions/setup-go@v3 + - uses: actions/setup-go@v4 with: go-version: 1.19 - - if: ${{ steps.release-please.outputs.release_created }} - name: Run GoReleaser + - name: Run GoReleaser uses: goreleaser/goreleaser-action@v2 with: version: latest args: release --rm-dist env: + REGISTRY: ghcr.io + IMAGE: ${{ github.repository }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.goreleaser.yml b/.goreleaser.yml index e758737..dbb1a42 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -47,8 +47,8 @@ changelog: dockers: - image_templates: - - "ghcr.io/jimeh/casecmp:{{ .Version }}-amd64" - - "ghcr.io/jimeh/casecmp:latest-amd64" + - "{{ .Env.REGISTRY }}/{{ .Env.IMAGE_NAME }}:{{ .Version }}-amd64" + - "{{ .Env.REGISTRY }}/{{ .Env.IMAGE_NAME }}:latest-amd64" dockerfile: Dockerfile use: buildx goos: linux @@ -56,8 +56,8 @@ dockers: build_flag_templates: - "--platform=linux/amd64" - image_templates: - - "ghcr.io/jimeh/casecmp:{{ .Version }}-386" - - "ghcr.io/jimeh/casecmp:latest-386" + - "{{ .Env.REGISTRY }}/{{ .Env.IMAGE_NAME }}:{{ .Version }}-386" + - "{{ .Env.REGISTRY }}/{{ .Env.IMAGE_NAME }}:latest-386" dockerfile: Dockerfile use: buildx goos: linux @@ -65,8 +65,8 @@ dockers: build_flag_templates: - "--platform=linux/386" - image_templates: - - "ghcr.io/jimeh/casecmp:{{ .Version }}-arm64" - - "ghcr.io/jimeh/casecmp:latest-arm64" + - "{{ .Env.REGISTRY }}/{{ .Env.IMAGE_NAME }}:{{ .Version }}-arm64" + - "{{ .Env.REGISTRY }}/{{ .Env.IMAGE_NAME }}:latest-arm64" use: buildx goos: linux goarch: arm64 @@ -74,8 +74,8 @@ dockers: build_flag_templates: - "--platform=linux/arm64" - image_templates: - - "ghcr.io/jimeh/casecmp:{{ .Version }}-armv6" - - "ghcr.io/jimeh/casecmp:latest-armv6" + - "{{ .Env.REGISTRY }}/{{ .Env.IMAGE_NAME }}:{{ .Version }}-armv6" + - "{{ .Env.REGISTRY }}/{{ .Env.IMAGE_NAME }}:latest-armv6" use: buildx goos: linux goarch: arm @@ -84,8 +84,8 @@ dockers: build_flag_templates: - "--platform=linux/arm/v6" - image_templates: - - "ghcr.io/jimeh/casecmp:{{ .Version }}-armv7" - - "ghcr.io/jimeh/casecmp:latest-armv7" + - "{{ .Env.REGISTRY }}/{{ .Env.IMAGE_NAME }}:{{ .Version }}-armv7" + - "{{ .Env.REGISTRY }}/{{ .Env.IMAGE_NAME }}:latest-armv7" use: buildx goos: linux goarch: arm @@ -95,17 +95,17 @@ dockers: - "--platform=linux/arm/v7" docker_manifests: - - name_template: ghcr.io/jimeh/casecmp:{{ .Version }} + - name_template: "{{ .Env.REGISTRY }}/{{ .Env.IMAGE_NAME }}:{{ .Version }}" image_templates: - - ghcr.io/jimeh/casecmp:{{ .Version }}-amd64 - - ghcr.io/jimeh/casecmp:{{ .Version }}-386 - - ghcr.io/jimeh/casecmp:{{ .Version }}-arm64 - - ghcr.io/jimeh/casecmp:{{ .Version }}-armv6 - - ghcr.io/jimeh/casecmp:{{ .Version }}-armv7 - - name_template: ghcr.io/jimeh/casecmp:latest + - "{{ .Env.REGISTRY }}/{{ .Env.IMAGE_NAME }}:{{ .Version }}-amd64" + - "{{ .Env.REGISTRY }}/{{ .Env.IMAGE_NAME }}:{{ .Version }}-386" + - "{{ .Env.REGISTRY }}/{{ .Env.IMAGE_NAME }}:{{ .Version }}-arm64" + - "{{ .Env.REGISTRY }}/{{ .Env.IMAGE_NAME }}:{{ .Version }}-armv6" + - "{{ .Env.REGISTRY }}/{{ .Env.IMAGE_NAME }}:{{ .Version }}-armv7" + - name_template: "{{ .Env.REGISTRY }}/{{ .Env.IMAGE_NAME }}:latest" image_templates: - - ghcr.io/jimeh/casecmp:latest-amd64 - - ghcr.io/jimeh/casecmp:latest-386 - - ghcr.io/jimeh/casecmp:latest-arm64 - - ghcr.io/jimeh/casecmp:latest-armv6 - - ghcr.io/jimeh/casecmp:latest-armv7 + - "{{ .Env.REGISTRY }}/{{ .Env.IMAGE_NAME }}:latest-amd64" + - "{{ .Env.REGISTRY }}/{{ .Env.IMAGE_NAME }}:latest-386" + - "{{ .Env.REGISTRY }}/{{ .Env.IMAGE_NAME }}:latest-arm64" + - "{{ .Env.REGISTRY }}/{{ .Env.IMAGE_NAME }}:latest-armv6" + - "{{ .Env.REGISTRY }}/{{ .Env.IMAGE_NAME }}:latest-armv7" From 438a238547bc7786388d1d755c138be2f2631293 Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Wed, 26 Apr 2023 18:28:18 +0100 Subject: [PATCH 3/3] chore(deps): upgrade to Go 1.20 --- .github/workflows/ci.yml | 4 ++-- go.mod | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9323061..cd8c2fb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-go@v4 with: - go-version: 1.19 + go-version: "1.20" - name: Install dependencies run: go mod download - name: Build binary @@ -68,7 +68,7 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} - uses: actions/setup-go@v4 with: - go-version: 1.19 + go-version: "1.20" - name: Run GoReleaser uses: goreleaser/goreleaser-action@v2 with: diff --git a/go.mod b/go.mod index 397e63e..f93ea72 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ module github.com/jimeh/casecmp -go 1.19 +go 1.20