From 8245a214c6af9e73b96d881d78e471cd6740ef37 Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Mon, 14 Nov 2022 21:32:40 +0000 Subject: [PATCH] build(release): use release-please for cutting releases --- .github/workflows/ci.yml | 36 ++++++++++++++++++++++------------- .goreleaser.yml | 20 +++++++++++++------ .release-please-manifest.json | 3 +++ release-please-config.json | 16 ++++++++++++++++ 4 files changed, 56 insertions(+), 19 deletions(-) create mode 100644 .release-please-manifest.json create mode 100644 release-please-config.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e782fef..e2c47e8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,8 +6,8 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-go@v2 + - uses: actions/checkout@v3 + - uses: actions/setup-go@v3 with: go-version: 1.18 - name: Install dependencies @@ -16,31 +16,41 @@ jobs: run: make - name: Run and make request run: | - ./bin/dotkatapult --port=8080 & + ./bin/dotkatapult & curl --silent --retry 10 --retry-delay 1 --retry-connrefused \ http://localhost:8080/ - release: + release-please: runs-on: ubuntu-latest needs: [test] - if: startsWith(github.ref, 'refs/tags/v') + if: github.ref == 'refs/heads/main' steps: - - uses: actions/checkout@v2 + - 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 with: fetch-depth: 0 - - name: Set up QEMU - uses: docker/setup-qemu-action@v1 - - uses: docker/setup-buildx-action@v1 - - name: Docker Login - uses: docker/login-action@v1 + - if: ${{ steps.release-please.outputs.release_created }} + 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/login-action@v2 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - - uses: actions/setup-go@v2 + - if: ${{ steps.release-please.outputs.release_created }} + uses: actions/setup-go@v3 with: go-version: 1.18 - - name: Run GoReleaser + - if: ${{ steps.release-please.outputs.release_created }} + name: Run GoReleaser uses: goreleaser/goreleaser-action@v2 with: version: latest diff --git a/.goreleaser.yml b/.goreleaser.yml index d122db6..49740bd 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -8,7 +8,7 @@ builds: flags: - -trimpath ldflags: - - "-s -w" + - "-s -w -X main.version={{ .Version }} -X main.commit={{ .Commit }}" goos: - "darwin" - "freebsd" @@ -23,16 +23,24 @@ builds: - "6" - "7" +archives: + - format: tar.gz + name_template: |- + {{ .ProjectName }}-{{ .Version }}_{{ .Os }}_{{ if eq .Arch "all" }}universal{{ else }}{{ .Arch }}{{ end }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if not (eq .Amd64 "v1") }}{{ .Amd64 }}{{ end }} + wrap_in_directory: true + format_overrides: + - goos: windows + format: zip + replacements: + darwin: macos + checksum: name_template: "checksums.txt" snapshot: name_template: "{{ .Tag }}-next" + changelog: - sort: asc - filters: - exclude: - - "^docs:" - - "^test:" + skip: true dockers: - image_templates: diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 0000000..3d2ac0b --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "0.1.0" +} \ No newline at end of file diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 0000000..9ba1d07 --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,16 @@ +{ + "bootstrap-sha": "d6789c97377f3b664c8ee987e8b2931b73d4a20f", + "last-release-sha": "d6789c97377f3b664c8ee987e8b2931b73d4a20f", + "release-type": "go", + "bump-minor-pre-major": true, + "bump-patch-for-minor-pre-major": true, + "packages": { + ".": { + "changelog-path": "CHANGELOG.md", + "draft": false, + "prerelease": false, + "extra-files": [] + } + }, + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json" +} \ No newline at end of file