Migrate to gha only#614
Conversation
james-nesbitt
commented
Mar 26, 2026
- switch to GHA for release operations
- clean up any release build information from Make system
- Drop individual .sha256 files and provide a single checksums.txt for all binaries. - Include FreeBSD builds in the release. - Maintain filename format: launchpad_<OS>_<ARCH>_<VERSION>.
- Remove unsupported --debug flag from local build. - Use --help flag to display available commands after build.
- GitHub Actions workflows now handle releases, so release-related targets are no longer needed. - Removed: build-release, clean-release, create-checksum, verify-checksum. - Kept: local, lint, and testing targets for development.
- Ensure only one 'go 1.25' statement exists in go.mod.
| name: Build Release Binaries | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: "1.22" | ||
|
|
||
| - name: Build binaries | ||
| run: | | ||
| mkdir -p dist | ||
| platforms=("linux/amd64" "linux/arm64" "windows/amd64" "windows/arm64" "darwin/amd64" "darwin/arm64") | ||
| for platform in "${platforms[@]}"; do | ||
| GOOS=${platform%/*} | ||
| GOARCH=${platform#*/} | ||
| output_name="dist/launchpad_${GOOS}_${GOARCH}" | ||
| if [ "$GOOS" = "windows" ]; then | ||
| output_name+=".exe" | ||
| fi | ||
| echo "Building $output_name" | ||
| GOOS=$GOOS GOARCH=$GOARCH go build -o "$output_name" ./main.go | ||
| done | ||
|
|
||
| - name: Upload artifacts | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: launchpad-release-binaries | ||
| path: dist/ | ||
|
|
||
| release: |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 2 months ago
To fix the problem, explicitly set a permissions block to scope down the GITHUB_TOKEN for each job, instead of relying on potentially broad repository defaults. The build job only needs to read repository contents and use artifacts, so contents: read is sufficient. The release job needs to create a GitHub Release, which requires contents: write, but does not obviously require other write scopes.
The best minimal fix without changing functionality is:
- Add a
permissionsblock underbuild:withcontents: read. - Add a
permissionsblock underrelease:withcontents: write.
We do not need to modify steps, environment variables, or add imports; the change is purely in .github/workflows/release.yml. The new permissions entries should be added right under each job definition line (build: and release:) so they apply at the job level. No other files are involved.
| @@ -12,6 +12,8 @@ | ||
| build: | ||
| name: Build Release Binaries | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| @@ -46,6 +48,8 @@ | ||
| name: Create GitHub Release | ||
| runs-on: ubuntu-latest | ||
| needs: build | ||
| permissions: | ||
| contents: write | ||
| steps: | ||
| - name: Download binaries | ||
| uses: actions/download-artifact@v4 |
| name: Create GitHub Release | ||
| runs-on: ubuntu-latest | ||
| needs: build | ||
| steps: | ||
| - name: Download binaries | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: launchpad-release-binaries | ||
| path: dist/ | ||
|
|
||
| - name: Create GitHub Release | ||
| uses: softprops/action-gh-release@v1 | ||
| with: | ||
| files: dist/* | ||
| generate_release_notes: true | ||
| draft: true | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| # TODO: Add Digicert signing here. | ||
| # TODO: Push signed artifacts to S3 here. No newline at end of file |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 2 months ago
In general, fix this by explicitly defining a permissions block that grants the least privileges needed. You can define it at the workflow root (applies to all jobs unless overridden) and, if a specific job needs more privileges, override just for that job.
For this workflow:
- The
buildjob only checks out code, sets up Go, builds binaries, and uploads artifacts. It requires only read access to repository contents and the ability to read artifacts; it does not need any write permissions. - The
releasejob downloads artifacts and creates a GitHub Release viasoftprops/action-gh-release, which needscontents: write(to create the release and upload assets). It does not obviously need write access to issues, pull requests, or other scopes.
The best minimal change is:
- Add a root‑level
permissionsblock withcontents: readso both jobs default to read‑only. - Add a
permissionsblock under thereleasejob that setscontents: write(overriding the root for that job only).
This leaves existing functionality unchanged (the release can still be created) while explicitly documenting and constraining token capabilities.
Concretely:
- At the top level, after
name: Releaseand beforeon:, add:permissions: contents: read
- Under the
releasejob (same indentation level asname: Create GitHub Releaseandruns-on), add:permissions: contents: write
No imports or extra methods are needed because this is a YAML workflow configuration change only.
| @@ -3,6 +3,9 @@ | ||
|
|
||
| name: Release | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| @@ -46,6 +49,8 @@ | ||
| name: Create GitHub Release | ||
| runs-on: ubuntu-latest | ||
| needs: build | ||
| permissions: | ||
| contents: write | ||
| steps: | ||
| - name: Download binaries | ||
| uses: actions/download-artifact@v4 |
- Add linting, unit tests, integration tests, build verification, and security scanning. - Trigger workflow on PRs to main branch.
| name: Lint Code | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: "1.25" | ||
|
|
||
| - name: Run golangci-lint | ||
| run: make lint | ||
|
|
||
| unit-test: |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 2 months ago
In general, the fix is to explicitly define a permissions: block that limits the GITHUB_TOKEN to the least privileges required. For this workflow, all jobs only need to read repository contents (for actions/checkout) and do not interact with issues, PRs, or other GitHub resources, so contents: read at the workflow level is sufficient.
The best change with no functional impact is to add a top-level permissions: block immediately after the name: and before on: in .github/workflows/pr.yml. This will apply to all jobs in the workflow (since none currently define their own permissions: blocks) and will restrict GITHUB_TOKEN to read-only access to repository contents. No per-job overrides are needed, and no additional imports or changes inside job steps are required.
Concretely:
- Edit
.github/workflows/pr.yml. - Insert:
permissions:
contents: readbetween the existing name: PR Validation line and the on: block. No other files or lines need to change.
| @@ -3,6 +3,9 @@ | ||
|
|
||
| name: PR Validation | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: [ main ] |
| name: Unit Tests | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: "1.25" | ||
|
|
||
| - name: Run unit tests | ||
| run: make unit-test | ||
|
|
||
| integration-test: |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 2 months ago
In general, fix this by adding an explicit permissions block that grants only the scopes needed by the jobs. Since all jobs in this workflow just check out code and run local commands, they only need read access to repository contents. The simplest, least‑privilege approach is to set permissions: contents: read at the workflow root so it applies to all jobs, unless overridden.
The single best fix without changing existing functionality is: in .github/workflows/pr.yml, immediately after the name: PR Validation line (line 4), add a root‑level permissions: block:
name: PR Validation
permissions:
contents: read
on:
pull_request:
branches: [ main ]This restricts the GITHUB_TOKEN to read‑only repository contents for all jobs (lint, unit-test, integration-test, build-verification, security-scan). No additional imports, methods, or definitions are needed because this is a YAML configuration change only.
| @@ -3,6 +3,9 @@ | ||
|
|
||
| name: PR Validation | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: [ main ] |
| name: Integration Tests | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: "1.25" | ||
|
|
||
| - name: Run integration tests | ||
| run: make integration-test | ||
|
|
||
| build-verification: |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 2 months ago
In general, the fix is to explicitly define the GITHUB_TOKEN permissions at the workflow or job level, granting only what is needed. Since all jobs in this workflow only perform read operations on the repository (checkout, build, test, security scan) and do not create or modify issues, PRs, releases, etc., they can safely run with contents: read. The simplest and clearest change is to add a root-level permissions block right after name: PR Validation. That way, the minimal permissions apply to all jobs, and we avoid repeating the same block for each job.
Concretely, in .github/workflows/pr.yml, insert:
permissions:
contents: readbetween the name: PR Validation line and the on: block. No additional methods, imports, or other definitions are required; this is purely a YAML configuration change within the workflow.
| @@ -3,6 +3,9 @@ | ||
|
|
||
| name: PR Validation | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: [ main ] |
| name: Build Verification | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: "1.25" | ||
|
|
||
| - name: Build binaries | ||
| run: | | ||
| mkdir -p dist | ||
| platforms=("linux/amd64" "linux/arm64" "windows/amd64" "windows/arm64" "darwin/amd64" "darwin/arm64") | ||
| for platform in "${platforms[@]}"; do | ||
| GOOS=${platform%/*} | ||
| GOARCH=${platform#*/} | ||
| output_name="dist/launchpad_${GOOS}_${GOARCH}" | ||
| if [ "$GOOS" = "windows" ]; then | ||
| output_name+=".exe" | ||
| fi | ||
| echo "Building $output_name" | ||
| GOOS=$GOOS GOARCH=$GOARCH go build -o "$output_name" ./main.go | ||
| done | ||
|
|
||
| security-scan: |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 2 months ago
To fix the problem, explicitly restrict the GITHUB_TOKEN permissions used by this workflow so they follow the principle of least privilege. Since all jobs only need to read the repository contents (to run make commands, tests, builds, and scans) and do not push changes, update PRs, or modify issues, we can set contents: read at the workflow level. This will apply to all jobs in the file unless overridden, and it avoids duplicating the same block for each job.
Concretely, in .github/workflows/pr.yml, add a permissions: block near the top-level (alongside name: and on:). For example, directly after the name: PR Validation line, insert:
permissions:
contents: readNo other imports, methods, or definitions are required; this is purely a YAML configuration change inside the existing workflow file. This change does not alter the functional behavior of the jobs, because they only require read access to the repository.
| @@ -2,6 +2,8 @@ | ||
| # Triggered on PRs to main branch. | ||
|
|
||
| name: PR Validation | ||
| permissions: | ||
| contents: read | ||
|
|
||
| on: | ||
| pull_request: |
| name: Security Scan | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: "1.25" | ||
|
|
||
| - name: Install govulncheck | ||
| run: go install golang.org/x/vuln/cmd/govulncheck@latest | ||
|
|
||
| - name: Run security scan | ||
| run: govulncheck ./... No newline at end of file |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 2 months ago
In general, the fix is to explicitly declare the minimal GITHUB_TOKEN permissions needed by the workflow, either at the root of the workflow (applying to all jobs) or per job. This workflow only checks out code and runs Go tooling; it does not need to write to the repo or modify issues/PRs. Therefore, the best fix is to add a workflow‑level permissions block that sets contents: read, which is the minimal useful scope for actions/checkout and covers all current jobs without changing their functionality.
Concretely, in .github/workflows/pr.yml, add a permissions: section near the top of the file (for example, right after the name: line) with contents: read. This will apply to all jobs (lint, unit-test, integration-test, build-verification, security-scan) unless overridden later, and satisfies CodeQL’s requirement while enforcing least privilege. No imports, methods, or additional definitions are required for this change.
| @@ -3,6 +3,9 @@ | ||
|
|
||
| name: PR Validation | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: [ main ] |
- Add permissions block to limit GITHUB_TOKEN to read-only access for contents. - Address GitHub CodeQL warning about over-privileged tokens.
| name: Build Binaries | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: "1.25" | ||
|
|
||
| - name: Build binaries | ||
| run: | | ||
| mkdir -p dist | ||
| platforms=("linux/amd64" "linux/arm64" "windows/amd64" "windows/arm64" "darwin/amd64" "darwin/arm64") | ||
| for platform in "${platforms[@]}"; do | ||
| GOOS=${platform%/*} | ||
| GOARCH=${platform#*/} | ||
| output_name="dist/launchpad_${GOOS}_${GOARCH}" | ||
| if [ "$GOOS" = "windows" ]; then | ||
| output_name+=".exe" | ||
| fi | ||
| echo "Building $output_name" | ||
| GOOS=$GOOS GOARCH=$GOARCH go build -o "$output_name" ./main.go | ||
| done | ||
|
|
||
| - name: Upload artifacts | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: launchpad-binaries | ||
| path: dist/ | ||
|
|
||
| test: |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 2 months ago
In general, the fix is to explicitly declare a minimal permissions block for the workflow or each job, limiting GITHUB_TOKEN to the least privilege required. For this workflow, the actions used (actions/checkout, actions/setup-go, go test, actions/upload-artifact) do not need to write to repository contents or pull requests, so contents: read at the workflow level is sufficient. No other fine-grained scopes (like pull-requests: write) are needed based on the shown steps.
The best way to fix this without changing functionality is to add a top-level permissions block right after the name: Build and Test line in .github/workflows/build.yml. This will apply to all jobs that do not override permissions, covering both build and test jobs. The block should be:
permissions:
contents: readNo imports or additional definitions are needed, since this is just YAML configuration. The only file to modify is .github/workflows/build.yml, and the changes are confined to adding the new lines after the name: line (line 4 in the provided snippet).
| @@ -2,6 +2,8 @@ | ||
| # Triggered on PRs and pushes to main. | ||
|
|
||
| name: Build and Test | ||
| permissions: | ||
| contents: read | ||
|
|
||
| on: | ||
| push: |
| name: Run Tests | ||
| runs-on: ubuntu-latest | ||
| needs: build | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: "1.22" | ||
|
|
||
| - name: Run unit tests | ||
| run: go test -v ./... | ||
|
|
||
| - name: Run integration tests | ||
| run: go test -v -tags=integration ./test/integration |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 2 months ago
In general, fix this by adding a permissions block that grants only the scopes required by the jobs. Since this workflow only checks out code, builds, runs tests, and uploads artifacts (which do not require repository write permissions), it can use read-only repository access.
The best minimal fix without changing behavior is to add a workflow-level permissions block (applies to all jobs) under the name: or on: section, setting contents: read. Neither the build nor test job needs finer-grained or write permissions, and actions/checkout, actions/setup-go, and actions/upload-artifact all work with read-only contents. No additional imports or external dependencies are required; this is purely a YAML configuration change inside .github/workflows/build.yml.
Concretely:
- Edit
.github/workflows/build.yml. - Insert:
permissions:
contents: readbetween the name: Build and Test line and the on: block (or immediately under on:; either is fine, but top-level is clearer). No other changes are necessary.
| @@ -3,6 +3,9 @@ | ||
|
|
||
| name: Build and Test | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ main ] |