-
Notifications
You must be signed in to change notification settings - Fork 299
ci(release): GitHub Releases for v0.1 (unsigned) #21
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
Changes from all commits
057efae
fab2e26
de3be65
3666297
7bfefe6
b2f9b2c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,20 @@ | ||
| name: Release | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| push: | ||
| branches: [main] | ||
| paths: | ||
| - '.changeset/**' | ||
| - 'packages/**' | ||
| - 'apps/**' | ||
| - 'package.json' | ||
| - 'pnpm-lock.yaml' | ||
| tags: | ||
| - 'v*.*.*' | ||
| workflow_dispatch: | ||
| inputs: | ||
| tag: | ||
| description: 'Tag to release (e.g. v0.1.0). Must start with "v"' | ||
| required: true | ||
| type: string | ||
| draft: | ||
| description: 'Create as draft release' | ||
| required: false | ||
| type: boolean | ||
| default: true | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
|
|
@@ -20,17 +25,125 @@ permissions: | |
| id-token: write | ||
|
|
||
| jobs: | ||
| release: | ||
| name: Version PR | ||
| # ------------------------------------------------------------------ | ||
| # Gate: lint / typecheck / test on ubuntu only (fast, cheap). | ||
| # Full matrix is already covered by ci.yml on PRs; we just need a | ||
| # quick sanity pass before we spend runner-minutes on packaging. | ||
| # ------------------------------------------------------------------ | ||
| gate: | ||
| name: Gate (lint · typecheck · test) | ||
| runs-on: ubuntu-latest | ||
| if: github.repository == 'OpenCoworkAI/open-codesign' | ||
| env: | ||
| RELEASE_REF: ${{ github.event_name == 'push' && github.ref || format('refs/tags/{0}', inputs.tag) }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| ref: ${{ env.RELEASE_REF }} | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Setup pnpm | ||
| uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4 | ||
|
|
||
| - name: Setup Node | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version-file: .nvmrc | ||
| cache: pnpm | ||
|
|
||
| - name: Install | ||
| run: pnpm install --frozen-lockfile | ||
|
|
||
| - name: Lint | ||
| run: pnpm lint | ||
|
|
||
| - name: Typecheck | ||
| run: pnpm typecheck | ||
|
|
||
| - name: Test | ||
| run: pnpm -r test | ||
|
|
||
| # ------------------------------------------------------------------ | ||
| # Changelog: build release notes from conventional commits. | ||
| # Runs in parallel with the gate; the build matrix waits for both. | ||
| # ------------------------------------------------------------------ | ||
| changelog: | ||
| name: Build changelog | ||
| runs-on: ubuntu-latest | ||
| if: github.repository == 'OpenCoworkAI/open-codesign' | ||
| env: | ||
| RELEASE_REF: ${{ github.event_name == 'push' && github.ref || format('refs/tags/{0}', inputs.tag) }} | ||
| outputs: | ||
| changelog: ${{ steps.build.outputs.changelog }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| ref: ${{ env.RELEASE_REF }} | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Build changelog | ||
| id: build | ||
| uses: mikepenz/release-changelog-builder-action@c9dc8369bccbc41e0ac887f8fd674f5925d315f7 # v5 | ||
| with: | ||
| configurationJson: | | ||
| { | ||
| "categories": [ | ||
| { | ||
| "title": "### Features", | ||
| "labels": ["feat"], | ||
| "rules": [{ "pattern": "^feat", "on_property": "title" }] | ||
| }, | ||
| { | ||
| "title": "### Bug Fixes", | ||
| "labels": ["fix"], | ||
| "rules": [{ "pattern": "^fix", "on_property": "title" }] | ||
| }, | ||
| { | ||
| "title": "### Documentation", | ||
| "labels": ["docs"], | ||
| "rules": [{ "pattern": "^docs", "on_property": "title" }] | ||
| }, | ||
| { | ||
| "title": "### Other Changes", | ||
| "rules": [{ "pattern": "^(chore|refactor|perf|test|ci)", "on_property": "title" }] | ||
| } | ||
| ], | ||
| "ignore_labels": ["skip-changelog"], | ||
| "sort": { "order": "DESC", "on_property": "mergedAt" }, | ||
| "template": "#{{CHANGELOG}}\n\n**Full Changelog**: #{{RELEASE_DIFF}}" | ||
| } | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| # ------------------------------------------------------------------ | ||
| # Build: native packaging per platform. | ||
| # electron-builder reads publish config from electron-builder.yml. | ||
| # We do NOT sign in v0.1 — notarization deferred to Stage 2. | ||
| # ------------------------------------------------------------------ | ||
| build: | ||
| name: Build (${{ matrix.os }}) | ||
| needs: [gate, changelog] | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| - os: macos-latest | ||
| artifact_glob: 'apps/desktop/release/*.dmg' | ||
| - os: windows-latest | ||
| artifact_glob: 'apps/desktop/release/*.exe' | ||
| - os: ubuntu-latest | ||
| artifact_glob: 'apps/desktop/release/*.AppImage' | ||
| runs-on: ${{ matrix.os }} | ||
| env: | ||
| RELEASE_REF: ${{ github.event_name == 'push' && github.ref || format('refs/tags/{0}', inputs.tag) }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| ref: ${{ env.RELEASE_REF }} | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Setup pnpm | ||
| uses: pnpm/action-setup@v4 | ||
| uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4 | ||
|
|
||
| - name: Setup Node | ||
| uses: actions/setup-node@v4 | ||
|
|
@@ -41,14 +154,70 @@ jobs: | |
| - name: Install | ||
| run: pnpm install --frozen-lockfile | ||
|
|
||
| # Versioning only. Publishing (npm + GitHub release artifacts) is | ||
| # intentionally NOT wired up yet — packaging needs code-signing | ||
| # (Mac notarization, Windows Authenticode) which we do not have. | ||
| - name: Create Version Pull Request | ||
| uses: changesets/action@v1 | ||
| # Build all workspace packages (turborepo respects dep graph) | ||
| - name: Build workspace | ||
| run: pnpm -r build --filter '!@open-codesign/desktop' | ||
|
|
||
| # Package the Electron app. | ||
| # CSC_IDENTITY_AUTO_DISCOVERY=false: skip ad-hoc Mac signing prompt. | ||
| # WIN_CSC_LINK / WIN_CSC_KEY_PASSWORD: intentionally unset (no cert in v0.1). | ||
| - name: Package desktop | ||
| env: | ||
| CSC_IDENTITY_AUTO_DISCOVERY: 'false' | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: pnpm --filter @open-codesign/desktop release | ||
|
|
||
| - name: Upload artifacts | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: installer-${{ matrix.os }} | ||
| path: ${{ matrix.artifact_glob }} | ||
| if-no-files-found: error | ||
| retention-days: 7 | ||
|
|
||
| # ------------------------------------------------------------------ | ||
| # Publish: create (or update draft) GitHub Release and attach files. | ||
| # ------------------------------------------------------------------ | ||
| publish: | ||
| name: Publish GitHub Release | ||
| needs: [build, changelog] | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| RELEASE_REF: ${{ github.event_name == 'push' && github.ref || format('refs/tags/{0}', inputs.tag) }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| ref: ${{ env.RELEASE_REF }} | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Validate tag input on dispatch | ||
| if: github.event_name == 'workflow_dispatch' | ||
| run: | | ||
| if [[ ! "${{ inputs.tag }}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+([.-][0-9A-Za-z.-]+)?$ ]]; then | ||
| echo "::error::tag must be semver-like (e.g. v1.2.3 or v1.2.3-rc.1)" | ||
| exit 1 | ||
| fi | ||
| # Verify the tag exists on the remote before proceeding | ||
| if ! git ls-remote --tags origin "refs/tags/${{ inputs.tag }}" | grep -q "${{ inputs.tag }}"; then | ||
| echo "::error::tag '${{ inputs.tag }}' does not exist on origin" | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Download all installers | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| path: dist/ | ||
| merge-multiple: true | ||
|
|
||
| - name: Create GitHub Release | ||
| uses: softprops/action-gh-release@3bb12739c298aeb8a4eeaf626c5b8d85266b0e65 # v2 | ||
| with: | ||
| version: pnpm version-packages | ||
| commit: 'chore(release): version packages' | ||
| title: 'chore(release): version packages' | ||
| tag_name: ${{ github.event_name == 'push' && github.ref_name || inputs.tag }} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Major] |
||
| name: ${{ github.event_name == 'push' && github.ref_name || inputs.tag }} | ||
| body: ${{ needs.changelog.outputs.changelog }} | ||
| draft: ${{ github.event_name == 'push' && false || inputs.draft }} | ||
| prerelease: ${{ contains(github.event_name == 'push' && github.ref_name || inputs.tag, '-') }} | ||
| files: dist/** | ||
| fail_on_unmatched_files: false | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Blocker]
publishdoes not checkout the repository, sogit ls-remote --tags origin ...in this step has no configuredoriginand fails onworkflow_dispatch.Suggested fix:
Place this before tag validation (or replace git usage with
gh apiagainst refs/tags).