-
Notifications
You must be signed in to change notification settings - Fork 0
[codex] add portable binary release validation #56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
johnnyhuy
wants to merge
1
commit into
main
Choose a base branch
from
codex/portable-binary-validation
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,179 @@ | ||
| name: Release Binaries | ||
|
|
||
| on: | ||
| release: | ||
| types: | ||
| - published | ||
| workflow_dispatch: | ||
| inputs: | ||
| ref: | ||
| description: Git ref to release, usually a tag like v1.0.0 | ||
| required: true | ||
| type: string | ||
|
|
||
| permissions: | ||
| contents: write | ||
|
|
||
| concurrency: | ||
| group: release-binaries-${{ github.event_name == 'release' && github.event.release.tag_name || inputs.ref }} | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| build: | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| - os: ubuntu-latest | ||
| targets: linux-x64-gnu,linux-x64-musl,linux-arm64-gnu,linux-arm64-musl | ||
| - os: macos-latest | ||
| targets: darwin-arm64,darwin-x64 | ||
| - os: windows-latest | ||
| targets: windows-x64 | ||
|
|
||
| runs-on: ${{ matrix.os }} | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 | ||
| with: | ||
| ref: ${{ github.event_name == 'release' && github.event.release.tag_name || inputs.ref }} | ||
|
|
||
| - name: Setup mise | ||
| uses: jdx/mise-action@c37c93293d6b742fc901e1406b8f764f6fb19dac | ||
|
|
||
| - name: Build targets | ||
| run: mise run build -- --targets=${{ matrix.targets }} | ||
|
|
||
| - name: Smoke test host artifact | ||
| run: bun scripts/smoke-artifact.ts | ||
|
|
||
| - name: Upload build artifacts | ||
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 | ||
| with: | ||
| name: release-${{ matrix.os }} | ||
| path: dist/* | ||
|
|
||
| upload: | ||
| needs: build | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 | ||
| with: | ||
| ref: ${{ github.event_name == 'release' && github.event.release.tag_name || inputs.ref }} | ||
|
|
||
| - name: Setup mise | ||
| uses: jdx/mise-action@c37c93293d6b742fc901e1406b8f764f6fb19dac | ||
|
|
||
| - name: Download build artifacts | ||
| uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 | ||
| with: | ||
| path: .artifacts | ||
| merge-multiple: true | ||
|
|
||
| - name: Assemble release assets | ||
| shell: bash | ||
| run: | | ||
| set -euo pipefail | ||
| mkdir -p dist | ||
| cp .artifacts/skillet-* dist/ || true | ||
| cp .artifacts/*.exe dist/ || true | ||
| bun scripts/write-checksums.ts | ||
|
|
||
| - name: Upload release assets | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| RELEASE_TAG: ${{ github.event_name == 'release' && github.event.release.tag_name || inputs.ref }} | ||
| shell: bash | ||
| run: | | ||
| set -euo pipefail | ||
| gh release upload "$RELEASE_TAG" dist/skillet-* dist/*.exe dist/SHA256SUMS --clobber | ||
|
|
||
| verify-homebrew: | ||
| needs: upload | ||
| runs-on: macos-latest | ||
| env: | ||
| HOMEBREW_NO_AUTO_UPDATE: 1 | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 | ||
| with: | ||
| ref: ${{ github.event_name == 'release' && github.event.release.tag_name || inputs.ref }} | ||
|
|
||
| - name: Install from Homebrew formula | ||
| run: brew install --formula ./packaging/homebrew/skillet.rb | ||
|
|
||
| - name: Verify Homebrew install | ||
| run: skillet --version | ||
|
|
||
| - name: Uninstall Homebrew formula | ||
| if: always() | ||
| run: brew uninstall skillet | ||
|
|
||
| verify-chocolatey: | ||
| needs: upload | ||
| runs-on: windows-latest | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 | ||
| with: | ||
| ref: ${{ github.event_name == 'release' && github.event.release.tag_name || inputs.ref }} | ||
|
|
||
| - name: Pack Chocolatey package | ||
| shell: pwsh | ||
| run: | | ||
| New-Item -ItemType Directory -Force -Path dist/choco | Out-Null | ||
| choco pack packaging/chocolatey/skillet.nuspec --outputdirectory dist/choco | ||
|
|
||
| - name: Install from Chocolatey package | ||
| shell: pwsh | ||
| run: | | ||
| choco install skillet --source "$PWD\dist\choco" --yes --no-progress | ||
|
|
||
| - name: Verify Chocolatey install | ||
| shell: pwsh | ||
| run: skillet --version | ||
|
|
||
| - name: Uninstall Chocolatey package | ||
| if: always() | ||
| shell: pwsh | ||
| run: | | ||
| choco uninstall skillet --yes --no-progress | ||
|
|
||
| verify-winget: | ||
| needs: upload | ||
| runs-on: windows-latest | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 | ||
| with: | ||
| ref: ${{ github.event_name == 'release' && github.event.release.tag_name || inputs.ref }} | ||
|
|
||
| - name: Validate winget manifests | ||
| shell: pwsh | ||
| run: | | ||
| $package = Get-Content package.json -Raw | ConvertFrom-Json | ||
| $manifest = Join-Path (Join-Path packaging/winget $package.version) 'echohello-dev.skillet.yaml' | ||
| winget validate $manifest | ||
|
|
||
| - name: Install from winget manifest | ||
| shell: pwsh | ||
| run: | | ||
| $package = Get-Content package.json -Raw | ConvertFrom-Json | ||
| $manifest = Join-Path (Join-Path packaging/winget $package.version) 'echohello-dev.skillet.yaml' | ||
| winget install --manifest $manifest --accept-source-agreements --accept-package-agreements --disable-interactivity | ||
|
|
||
| - name: Verify winget install | ||
| shell: pwsh | ||
| run: skillet --version | ||
|
|
||
| - name: Uninstall winget package | ||
| if: always() | ||
| shell: pwsh | ||
| run: | | ||
| winget uninstall --id echohello-dev.skillet --exact --disable-interactivity || exit 0 |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,6 +31,9 @@ run = "mise run build -- --targets=linux-x64-musl,linux-arm64-musl && docker bui | |
| [tasks.build-npm] | ||
| run = "mise run install && bun scripts/build-npm-cli.ts" | ||
|
|
||
| [tasks.package-validate] | ||
| run = "mise run install && bun scripts/validate-packaging.ts" | ||
|
|
||
| [tasks.npm-smoke] | ||
| run = "mise run build-npm && npm pack >/tmp/skillet-npm-pack.log && PACKAGE=$(tail -n 1 /tmp/skillet-npm-pack.log) && npx --yes --package \"./$PACKAGE\" sklt --help && REPO_DIR=\"$PWD\" && TMP_DIR=$(mktemp -d) && (cd \"$TMP_DIR\" && bun init -y >/dev/null 2>&1 && bun add \"$REPO_DIR/$PACKAGE\" >/dev/null && bunx --bun sklt --help) && rm -rf \"$TMP_DIR\" \"$PACKAGE\"" | ||
|
|
||
|
|
||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,11 +2,9 @@ PackageIdentifier: echohello-dev.skillet | |
| PackageVersion: 0.0.0 | ||
| Installers: | ||
| - Architecture: x64 | ||
| InstallerType: exe | ||
| InstallerType: portable | ||
| InstallerUrl: https://github.com/echohello-dev/skillet/releases/download/v0.0.0/skillet-windows-x64.exe | ||
| InstallerSha256: 51CDDEFDE243F0F27E501CA420D5E1D1B9CAD548DC9884EA4052D2915AFEF179 | ||
| AppsAndFeaturesEntries: | ||
| - DisplayName: skillet | ||
| Commands: | ||
| - skillet | ||
| ManifestType: installer | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
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.
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Copilot Autofix
AI 8 days ago
In general, to fix this issue you add a
permissions:block to the workflow (either at the root level so it applies to all jobs, or per job) and set it to the minimum scopes required. For CI workflows that only read the code and upload artifacts (using actions that do not require repo writes),contents: readis a good minimal starting point.For this specific workflow, the steps use:
actions/checkoutto read the repositoryjdx/mise-action,docker/setup-qemu-action,actions/upload-artifact, andactions/download-artifactAll of these operate with the
GITHUB_TOKENat most needing read access to repository contents (and the artifact actions typically work without additional repo write permissions). There is no indication of any step that pushes commits, creates releases, or modifies issues/PRs.The single best fix is therefore:
permissions:block after theon:section (e.g., after line 8) settingcontents: read. This will apply to all jobs (build,checksums,qemu-smoke,wine-smoke,docker-integration,packaging-validate, etc.) unless they override it.Concretely:
Edit
.github/workflows/build-matrix.yaml.Insert:
between the
on:block and thejobs:key.