-
-
Notifications
You must be signed in to change notification settings - Fork 307
feat: Official CLI Support — game-ci #813
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
Closed
Closed
Changes from 5 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
5a42214
feat: add official game-ci CLI with build, activate, and orchestrate …
frostebite 5bdcf12
feat(cli): add npm publish workflow and CLI tests
frostebite 79d12aa
feat(cli): add release workflow, install scripts, and self-update com…
frostebite 280a10d
fix(cli): address review findings — exit codes, missing inputs, null …
frostebite c6e56f7
fix(ci): update integrity workflow to Node 20 for yargs@18 compatibility
frostebite 664cffa
ci: set macOS builds to continue-on-error
frostebite f0aca9e
refactor(cli): reorganize commands — add test, alias orchestrate to o…
frostebite 77b9d90
ci: mark failed macOS builds as neutral instead of failure
frostebite e9260fa
revert: restore build-tests-mac.yml to match main
frostebite 5e3860e
fix: downgrade yargs to ^17.7.2 and revert Node to 18 for CI compatib…
frostebite 6d2defa
fix: replace orchestrator-develop branch references with main
frostebite 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,170 @@ | ||
| name: Release CLI | ||
|
|
||
| on: | ||
| release: | ||
| types: [published] | ||
| workflow_dispatch: | ||
| inputs: | ||
| tag: | ||
| description: 'Release tag to build (e.g., v2.0.0). Uses latest release if empty.' | ||
| required: false | ||
| type: string | ||
| publish-npm: | ||
| description: 'Publish to npm' | ||
| required: false | ||
| default: false | ||
| type: boolean | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.event.release.tag_name || inputs.tag || github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| build-binaries: | ||
| name: Build ${{ matrix.target }} | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| - target: linux-x64 | ||
| os: ubuntu-latest | ||
| pkg-target: node20-linux-x64 | ||
| binary-name: game-ci-linux-x64 | ||
| - target: linux-arm64 | ||
| os: ubuntu-latest | ||
| pkg-target: node20-linux-arm64 | ||
| binary-name: game-ci-linux-arm64 | ||
| - target: macos-x64 | ||
| os: macos-latest | ||
| pkg-target: node20-macos-x64 | ||
| binary-name: game-ci-macos-x64 | ||
| - target: macos-arm64 | ||
| os: macos-latest | ||
| pkg-target: node20-macos-arm64 | ||
| binary-name: game-ci-macos-arm64 | ||
| - target: windows-x64 | ||
| os: windows-latest | ||
| pkg-target: node20-win-x64 | ||
| binary-name: game-ci-windows-x64.exe | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| ref: ${{ github.event.release.tag_name || inputs.tag || github.ref }} | ||
|
|
||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '20' | ||
|
|
||
| - name: Install dependencies | ||
| run: yarn install --frozen-lockfile | ||
|
|
||
| - name: Build TypeScript | ||
| run: yarn build | ||
|
|
||
| - name: Verify CLI before packaging | ||
| run: node lib/cli.js version | ||
|
|
||
| - name: Build standalone binary | ||
| run: npx pkg lib/cli.js --target ${{ matrix.pkg-target }} --output ${{ matrix.binary-name }} --compress GZip | ||
|
|
||
| - name: Verify standalone binary (non-cross-compiled) | ||
| if: | | ||
| (matrix.target == 'linux-x64' && runner.os == 'Linux') || | ||
| (matrix.target == 'macos-arm64' && runner.os == 'macOS' && runner.arch == 'ARM64') || | ||
| (matrix.target == 'macos-x64' && runner.os == 'macOS' && runner.arch == 'X64') || | ||
| (matrix.target == 'windows-x64' && runner.os == 'Windows') | ||
| run: ./${{ matrix.binary-name }} version | ||
| shell: bash | ||
|
|
||
| - uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: binary-${{ matrix.target }} | ||
| path: ${{ matrix.binary-name }} | ||
| retention-days: 5 | ||
|
|
||
| create-checksums-and-upload: | ||
| name: Checksums and release upload | ||
| needs: build-binaries | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| steps: | ||
| - uses: actions/download-artifact@v4 | ||
| with: | ||
| path: binaries | ||
| pattern: binary-* | ||
| merge-multiple: true | ||
|
|
||
| - name: List binaries | ||
| run: ls -la binaries/ | ||
|
|
||
| - name: Generate SHA256 checksums | ||
| run: | | ||
| cd binaries | ||
| sha256sum game-ci-* > checksums.txt | ||
| echo "=== checksums.txt ===" | ||
| cat checksums.txt | ||
|
|
||
| - name: Determine release tag | ||
| id: tag | ||
| run: | | ||
| if [ "${{ github.event_name }}" = "release" ]; then | ||
| echo "tag=${{ github.event.release.tag_name }}" >> "$GITHUB_OUTPUT" | ||
| elif [ -n "${{ inputs.tag }}" ]; then | ||
| echo "tag=${{ inputs.tag }}" >> "$GITHUB_OUTPUT" | ||
| else | ||
| echo "No release tag available. Skipping upload." | ||
| echo "tag=" >> "$GITHUB_OUTPUT" | ||
| fi | ||
|
|
||
| - name: Upload binaries to release | ||
| if: steps.tag.outputs.tag != '' | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| run: | | ||
| cd binaries | ||
| for f in game-ci-* checksums.txt; do | ||
| echo "Uploading $f..." | ||
| gh release upload "${{ steps.tag.outputs.tag }}" "$f" \ | ||
| --repo "${{ github.repository }}" \ | ||
| --clobber | ||
| done | ||
|
|
||
| publish-npm: | ||
| name: Publish to npm | ||
| needs: build-binaries | ||
| runs-on: ubuntu-latest | ||
| if: >- | ||
| (github.event_name == 'release') || (github.event_name == 'workflow_dispatch' && inputs.publish-npm) | ||
| permissions: | ||
| contents: read | ||
| id-token: write | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| ref: ${{ github.event.release.tag_name || inputs.tag || github.ref }} | ||
|
|
||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '20' | ||
| registry-url: 'https://registry.npmjs.org' | ||
|
|
||
| - name: Install dependencies | ||
| run: yarn install --frozen-lockfile | ||
|
|
||
| - name: Build | ||
| run: yarn build | ||
|
|
||
| - name: Run tests | ||
| run: yarn test | ||
|
|
||
| - name: Verify CLI | ||
| run: | | ||
| node lib/cli.js version | ||
| node lib/cli.js --help | ||
|
|
||
| - name: Publish to npm | ||
| run: npm publish --provenance --access public | ||
| env: | ||
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
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 14 days ago
Generally, the fix is to explicitly set least-privilege
permissionsfor any job (or workflow) that uses the default GITHUB_TOKEN permissions. For this workflow, thebuild-binariesjob only needs to read repository contents and interact with artifacts; it does not write to the repository, issues, or releases. Therefore, we should give itcontents: read.The best minimal fix without changing functionality is to add a
permissionsblock under thebuild-binariesjob, similar to the other jobs. Concretely, in.github/workflows/release-cli.yml, underjobs:, within thebuild-binaries:job definition and alongsideruns-onandstrategy, insert:No additional imports, methods, or definitions are needed; this is purely a YAML configuration change in the workflow file.