release canary #150
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
| name: publish | |
| run-name: "${{ format('release {0}', inputs.bump) }}" | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| bump: | |
| description: "Bump major, minor, patch, beta, or canary" | |
| required: false | |
| type: choice | |
| options: | |
| - major | |
| - minor | |
| - patch | |
| - beta | |
| - canary | |
| version: | |
| description: "Override version (optional)" | |
| required: false | |
| type: string | |
| platform: | |
| description: "Build only this OS (all = every platform)" | |
| required: false | |
| type: choice | |
| default: all | |
| options: | |
| - all | |
| - windows | |
| - linux | |
| - darwin | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }}-${{ inputs.version || inputs.bump }} | |
| cancel-in-progress: true | |
| permissions: | |
| id-token: write | |
| contents: write | |
| jobs: | |
| version: | |
| runs-on: ubuntu-24.04 | |
| if: github.repository == 'CyberStrikeus/CyberStrike' | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - uses: ./.github/actions/setup-bun | |
| - name: Install CyberStrike | |
| if: inputs.bump || inputs.version | |
| continue-on-error: true | |
| run: bun i -g @cyberstrike-io/cyberstrike | |
| - id: version | |
| run: | | |
| ./script/version.ts | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| CYBERSTRIKE_BUMP: ${{ inputs.bump }} | |
| CYBERSTRIKE_VERSION: ${{ inputs.version }} | |
| CYBERSTRIKE_API_KEY: ${{ secrets.CYBERSTRIKE_API_KEY }} | |
| outputs: | |
| version: ${{ steps.version.outputs.version }} | |
| release: ${{ steps.version.outputs.release }} | |
| tag: ${{ steps.version.outputs.tag }} | |
| build-app: | |
| needs: version | |
| runs-on: ubuntu-24.04 | |
| if: github.repository == 'CyberStrikeus/CyberStrike' | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: ./.github/actions/setup-bun | |
| - name: Build Web UI | |
| run: bun install && bun turbo build --filter=@cyberstrike-io/app | |
| env: | |
| CYBERSTRIKE_VERSION: ${{ needs.version.outputs.version }} | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: cyberstrike-web | |
| path: packages/app/dist | |
| build-cli: | |
| needs: version | |
| runs-on: ubuntu-24.04 | |
| if: github.repository == 'CyberStrikeus/CyberStrike' | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| fetch-tags: true | |
| - uses: ./.github/actions/setup-bun | |
| - name: Build | |
| id: build | |
| run: | | |
| ./packages/cyberstrike/script/build.ts | |
| env: | |
| CYBERSTRIKE_VERSION: ${{ needs.version.outputs.version }} | |
| CYBERSTRIKE_RELEASE: ${{ needs.version.outputs.release }} | |
| CYBERSTRIKE_BUILD_OS: ${{ inputs.platform == 'all' && '' || inputs.platform }} | |
| GH_TOKEN: ${{ github.token }} | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: cyberstrike-cli | |
| path: packages/cyberstrike/dist | |
| outputs: | |
| version: ${{ needs.version.outputs.version }} | |
| publish: | |
| needs: | |
| - version | |
| - build-cli | |
| - build-app | |
| if: ${{ !cancelled() && needs.build-cli.result == 'success' && needs.build-app.result == 'success' }} | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: ./.github/actions/setup-bun | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "24" | |
| registry-url: "https://registry.npmjs.org" | |
| - name: Setup git committer | |
| id: committer | |
| continue-on-error: true | |
| uses: ./.github/actions/setup-git-committer | |
| with: | |
| cyberstrike-app-id: ${{ vars.CYBERSTRIKE_APP_ID }} | |
| cyberstrike-app-secret: ${{ secrets.CYBERSTRIKE_APP_SECRET }} | |
| - name: Fallback git config | |
| if: steps.committer.outcome == 'failure' | |
| run: | | |
| git config --global user.name "cyberstrike[bot]" | |
| git config --global user.email "cyberstrike[bot]@users.noreply.github.com" | |
| git remote set-url origin "https://x-access-token:${{ secrets.PUBLISH_TOKEN }}@github.com/${{ github.repository }}" | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: cyberstrike-cli | |
| path: packages/cyberstrike/dist | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: cyberstrike-web | |
| path: packages/app/dist | |
| - run: ./script/publish.ts | |
| env: | |
| CYBERSTRIKE_VERSION: ${{ needs.version.outputs.version }} | |
| CYBERSTRIKE_RELEASE: ${{ needs.version.outputs.release }} | |
| GITHUB_TOKEN: ${{ steps.committer.outputs.token || secrets.PUBLISH_TOKEN || github.token }} | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| NPM_CONFIG_PROVENANCE: false |