Skip to content

Mirror releases + install scripts to S3 for GitHub-restricted hosts#12

Merged
ysyneu merged 1 commit into
mainfrom
feat/cdn-install-mirror
May 28, 2026
Merged

Mirror releases + install scripts to S3 for GitHub-restricted hosts#12
ysyneu merged 1 commit into
mainfrom
feat/cdn-install-mirror

Conversation

@ysyneu
Copy link
Copy Markdown
Contributor

@ysyneu ysyneu commented May 28, 2026

Summary

Adds an opt-in CDN mirror so the CLI can be installed where github.com is unreachable (e.g. mainland-China cloud hosts), mirroring the pattern already used in flashduty-runner. The mirror host is never published in the repo — it's supplied at call time via MIRROR_URL / the MIRROR_S3_* secrets, so the billable CDN address isn't exposed to scraping/abuse.

  • .github/workflows/release.yml — after GoReleaser, mirror *.tar.gz/*.zip/checksums.txt to an S3-compatible bucket at <PREFIX>/releases/download/<tag>/… and write a plain-text <PREFIX>/releases/latest pointer. Gated on MIRROR_S3_* secrets; skips cleanly when unset.
  • .github/workflows/install-scripts.yml (new) — shellcheck + parse install.sh, then mirror install.sh + install.ps1 to <PREFIX>/install.sh / <PREFIX>/install.ps1 on push to main.
  • install.sh / install.ps1 — honor MIRROR_URL: resolve the version pointer and download assets from the mirror instead of GitHub; verify against checksums.txt (warn-and-skip for the 18 pre-mirror releases that don't ship one); validate the network-resolved release tag before interpolating it into a URL.
  • .goreleaser.yml — pin checksum file name to checksums.txt (matches the runner) so the verification path has a stable asset name going forward.

Default behavior is unchanged: with no MIRROR_URL, everything still installs straight from GitHub.

Required follow-up (repo secrets)

The mirror is inert until these repo secrets are set (same names as flashduty-runner): MIRROR_S3_ACCESS_KEY_ID, MIRROR_S3_SECRET_ACCESS_KEY, MIRROR_S3_REGION, MIRROR_S3_BUCKET, MIRROR_S3_ENDPOINT, MIRROR_S3_PATH_PREFIX (= flashduty-cli).

Test plan

  • shellcheck -s sh install.sh + sh -n + bash -n clean
  • Workflow YAML validates
  • No static.flashcat.cloud (or any mirror host) present in tracked files
  • After secrets are set: cut a tag, confirm assets + releases/latest land on the mirror
  • MIRROR_URL=<mirror> sh install.sh installs end-to-end on a GitHub-blocked host
  • pwsh parse / smoke of install.ps1 (couldn't run pwsh locally)

…osts

Add an opt-in CDN mirror path so the CLI can be installed where github.com
is unreachable, without exposing the mirror host in the repo:

- release.yml: mirror release binaries + checksums.txt + a releases/latest
  pointer to an S3-compatible bucket (driven by MIRROR_S3_* secrets; skips
  when unset).
- install-scripts.yml: lint install.sh and mirror install.sh + install.ps1
  to the same bucket on push to main.
- install.sh / install.ps1: honor MIRROR_URL to resolve the version pointer
  and download assets from the mirror instead of GitHub, with checksums.txt
  verification (warn-and-skip for pre-mirror releases) and release-tag
  validation on the network-resolved version.
- .goreleaser.yml: pin the checksum file name to checksums.txt so the
  verification path has a stable asset name.

The mirror host is supplied at call time via MIRROR_URL / the S3 secrets, so
the billable CDN address is never published in the repo.
@ysyneu ysyneu merged commit 679e692 into main May 28, 2026
14 checks passed
@ysyneu ysyneu deleted the feat/cdn-install-mirror branch May 28, 2026 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant