From 0f4b819a7bdec010286b2ca1fd827b8be5b8e494 Mon Sep 17 00:00:00 2001 From: k1LoW Date: Thu, 25 Jan 2024 21:17:40 +0900 Subject: [PATCH] Fix CD pipeline --- .github/workflows/tagpr.yml | 27 ++++++++++++++++++++------- .goreleaser/darwin.yml | 3 +++ .goreleaser/linux.yml | 3 +++ .goreleaser/windows.yml | 3 +++ .tagpr | 1 + Makefile | 3 --- 6 files changed, 30 insertions(+), 10 deletions(-) diff --git a/.github/workflows/tagpr.yml b/.github/workflows/tagpr.yml index 90dd8564..5e9b9023 100644 --- a/.github/workflows/tagpr.yml +++ b/.github/workflows/tagpr.yml @@ -24,7 +24,7 @@ jobs: name: Run tagpr uses: Songmu/tagpr@v1 - darwin-release: + darwin-assets: needs: tagpr if: needs.tagpr.outputs.tagpr-tag != '' runs-on: macos-latest @@ -43,14 +43,18 @@ jobs: - name: Setup run: | - brew install goreleaser brew install sqlite3 - - name: Release - run: | - make release_darwin + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v5 + with: + distribution: goreleaser + version: latest + args: --config .goreleaser/darwin.yml --clean + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - linux-release: + linux-assets: needs: tagpr if: needs.tagpr.outputs.tagpr-tag != '' runs-on: ubuntu-latest @@ -101,7 +105,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - windows-release: + windows-assets: needs: tagpr if: needs.tagpr.outputs.tagpr-tag != '' runs-on: windows-2019 @@ -196,3 +200,12 @@ jobs: org.opencontainers.image.revision=${{ github.sha }} org.opencontainers.image.version=${{ steps.latest_version.outputs.version }} org.opencontainers.image.source=https://github.com/k1LoW/tbls + release: + needs: [tagpr, darwin-assets, linux-assets, windows-assets, dockerimage] + runs-on: ubuntu-latest + steps: + - name: Release + run: | + gh api /repos/${{ github.repository }}/releases/generate-notes -f tag_name=${{ needs.tagpr.outputs.tagpr-tag }} --jq .body | gh release edit ${{ needs.tagpr.outputs.tagpr-tag }} --repo ${{ github.repository }} --draft=false --latest --notes-file=- + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.goreleaser/darwin.yml b/.goreleaser/darwin.yml index e6d684e8..1c307892 100644 --- a/.goreleaser/darwin.yml +++ b/.goreleaser/darwin.yml @@ -37,3 +37,6 @@ changelog: exclude: - '^docs:' - '^test:' +release: + draft: true + replace_existing_draft: true diff --git a/.goreleaser/linux.yml b/.goreleaser/linux.yml index 4e51dcfd..ac9eb48d 100644 --- a/.goreleaser/linux.yml +++ b/.goreleaser/linux.yml @@ -64,3 +64,6 @@ nfpms: - apk bindir: /usr/bin epoch: 1 +release: + draft: true + replace_existing_draft: true diff --git a/.goreleaser/windows.yml b/.goreleaser/windows.yml index 4a972657..752823e3 100644 --- a/.goreleaser/windows.yml +++ b/.goreleaser/windows.yml @@ -43,3 +43,6 @@ changelog: exclude: - '^docs:' - '^test:' +release: + draft: true + replace_existing_draft: true diff --git a/.tagpr b/.tagpr index 3f3f3268..d15755be 100644 --- a/.tagpr +++ b/.tagpr @@ -32,5 +32,6 @@ [tagpr] vPrefix = true releaseBranch = main + release = draft versionFile = version/version.go command = "make prerelease_for_tagpr" diff --git a/Makefile b/Makefile index 4b0a44d1..cd91e152 100644 --- a/Makefile +++ b/Makefile @@ -180,7 +180,4 @@ prerelease_for_tagpr: depsdev gocredits -w . git add CHANGELOG.md CREDITS go.mod go.sum -release_darwin: - goreleaser --config .goreleaser/darwin.yml --clean - .PHONY: default test