ci(release): fix goreleaser pipeline and enable fork-friendly releases#171
Open
warku123 wants to merge 4 commits into
Open
ci(release): fix goreleaser pipeline and enable fork-friendly releases#171warku123 wants to merge 4 commits into
warku123 wants to merge 4 commits into
Conversation
- Add HOMEBREW_TAP_TOKEN to job-level env for probing in if: conditions - Compute --skip=brew,docker flags when the corresponding secrets are absent so forks still produce binary tarballs + GitHub Releases without needing Docker Hub or homebrew-tap credentials - Guard QEMU/Buildx setup steps behind DOCKERHUB_USERNAME to avoid unnecessary setup on forks - Remove hardcoded release.github.owner/name from .goreleaser.yaml so goreleaser auto-detects the target repo from GITHUB_TOKEN; this lets any fork cut a real release by pushing a v* tag
… dockers_v2 dockers_v2 places binaries at linux/amd64/<bin> and linux/arm64/<bin> in the build context, not at the flat path <bin>. COPY needs ARG TARGETPLATFORM so Docker buildx resolves the correct platform directory at build time.
GITHUB_TOKEN only grants permissions on the current repo, so pushing to tronprotocol/homebrew-tap requires a separate PAT. Add token field so goreleaser uses HOMEBREW_TAP_TOKEN for the tap push; the skip flag in release.yml already skips homebrew when this token is absent.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fixes three inter-related issues in the goreleaser release pipeline so that pushing a
v*tag produces a complete, correctly signed GitHub Release — binary tarballs, checksums, cosign signatures — and gracefully skips optional distribution channels (Docker Hub, Homebrew tap) when the required secrets are absent.Background / motivation: A stable upstream release is a hard prerequisite for the system-test integration work tracked in #170. Once this PR merges and a tag is cut,
stest-up.shcan downloadtrondfrom the officialtronprotocol/tron-deploymentreleases instead of a fork, giving the java-tron CI a stable, versioned artefact to depend on.Changes:
Dockerfile.release— addARG TARGETPLATFORMand change theCOPYline toCOPY $TARGETPLATFORM/trond /usr/local/bin/trond. GoReleaser'sdockers_v2block places each platform binary atlinux/amd64/trond/linux/arm64/trondin the build context; without this change the docker build fails with"/trond": not found..goreleaser.yaml:token: "{{ .Env.HOMEBREW_TAP_TOKEN }}"tobrews.repositoryso goreleaser uses the dedicated tap token rather than the repo-scopedGITHUB_TOKEN(which cannot push to a different repository).release: draft: false / prerelease: autoblock to make pre-release detection explicit..github/workflows/release.yml:DOCKERHUB_USERNAMEandHOMEBREW_TAP_TOKENto the job-levelenv:block — secrets are not accessible in step-levelif:expressions, but job-levelenv:values are.if: env.DOCKERHUB_USERNAME != ''so forks without Docker Hub credentials skip those steps instead of erroring.--skip=dockerand/or--skip=homebrewwhen the corresponding secrets are absent, so the binary tarball + GitHub Release always succeed regardless of which optional secrets are configured.Why are these changes required?
The previous pipeline failed on every tag push: the docker step crashed (
"/trond": not found), and the skip logic was absent so the homebrew push would also fail on forks. Together these blocked the GitHub Release from being created at all. Forks/contributors wanting to cut a release need to produce binary tarballs and a signed checksums file without requiring Docker Hub or Homebrew secrets.This PR has been tested by:
goreleaser release --snapshot --clean --skip=sign— confirmed 4 platform binaries built, both linux/amd64 and linux/arm64 docker images produced.v0.1.2-rc.1pushed to the fork (warku123/tron-deployment) — full CI release run succeeded; GitHub Release created with tarballs,checksums.txt,.sig, and.pemartefacts.Checklist
java.lang.MathorMaths— N/A (Go/YAML changes only)System.out.printlnor leftover TODOsFollow up
Before release:
v0.1.2or similar) after this merges so downstream consumers get a realreleases/latestentry — pre-release tags are excluded from the GitHub APIreleases/latestresponse.After release:
2. Switch
stest-up.shdefault fromwarku123/tron-deploymenttotronprotocol/tron-deploymentonce an upstream release is published (tracked in #170).3. Embed stest HOCON template into trond (follow-on to #170) so the intent YAML can reference the built-in
system-testnetwork config without carrying the file separately.4. Add Docker Hub / Homebrew Tap secrets to the
tronprotocolorg if those distribution channels are desired — no code changes required, secrets alone unlock them.Related PR: #170 feat(config): add system-test as fourth embedded HOCON network template