-
Notifications
You must be signed in to change notification settings - Fork 0
ci: add pipeline for iii-lsp #22
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
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 |
|---|---|---|
| @@ -0,0 +1,113 @@ | ||
| name: Release LSP Binary | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - 'iii-lsp/v*' | ||
| workflow_dispatch: | ||
| inputs: | ||
| tag: | ||
| description: 'Tag to release (e.g., iii-lsp/v1.0.0)' | ||
| required: true | ||
| type: string | ||
|
|
||
| permissions: | ||
| contents: write | ||
|
|
||
| concurrency: | ||
| group: release-iii-lsp-${{ github.ref }} | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| # ────────────────────────────────────────────────────────────── | ||
| # Setup: Parse tag metadata | ||
| # ────────────────────────────────────────────────────────────── | ||
|
|
||
| setup: | ||
| name: Setup | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| tag: ${{ steps.resolve.outputs.tag }} | ||
| version: ${{ steps.meta.outputs.version }} | ||
| is_prerelease: ${{ steps.meta.outputs.is_prerelease }} | ||
| dry_run: ${{ steps.meta.outputs.dry_run }} | ||
| steps: | ||
| - name: Resolve tag | ||
| id: resolve | ||
| run: | | ||
| TAG="${{ inputs.tag || github.ref_name }}" | ||
| echo "tag=$TAG" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Extract metadata from tag | ||
| id: meta | ||
| env: | ||
| TAG: ${{ steps.resolve.outputs.tag }} | ||
| run: | | ||
| VERSION="${TAG#iii-lsp/v}" | ||
|
|
||
| if [[ "$VERSION" =~ -dry-run\.[0-9]+$ ]]; then | ||
| echo "dry_run=true" >> "$GITHUB_OUTPUT" | ||
| echo "is_prerelease=true" >> "$GITHUB_OUTPUT" | ||
| elif [[ "$VERSION" =~ -([a-z]+)\.[0-9]+$ ]]; then | ||
| echo "dry_run=false" >> "$GITHUB_OUTPUT" | ||
| echo "is_prerelease=true" >> "$GITHUB_OUTPUT" | ||
| else | ||
| echo "dry_run=false" >> "$GITHUB_OUTPUT" | ||
| echo "is_prerelease=false" >> "$GITHUB_OUTPUT" | ||
| fi | ||
|
|
||
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | ||
| echo "::notice::iii-lsp release -- tag=$TAG version=$VERSION" | ||
|
Comment on lines
+35
to
+60
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. 🧩 Analysis chain🌐 Web query:
💡 Result: If you pass a So it does not automatically create the tag from the workflow run’s commit unless you explicitly set:
Otherwise, the tag is created from the repo’s default branch by default. [2] Sources: 🏁 Script executed: # First, let's find and read the workflow file
find . -name "release-lsp-binary.yml" -type fRepository: iii-hq/workers Length of output: 100 🏁 Script executed: # If found, read the entire workflow file to understand context
cat -n .github/workflows/release-lsp-binary.ymlRepository: iii-hq/workers Length of output: 4363 Validate manual dispatch input against tag format before creating release. Line 38 accepts arbitrary user input for manual dispatch without format validation. Line 46 blindly strips
Push-triggered events are safe (GitHub enforces Proposed fix - name: Resolve tag
id: resolve
run: |
TAG="${{ inputs.tag || github.ref_name }}"
+ if [[ ! "$TAG" =~ ^iii-lsp/v[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?$ ]]; then
+ echo "::error::Invalid tag format: $TAG"
+ exit 1
+ fi
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
+
+ - name: Verify tag exists (manual dispatch)
+ if: github.event_name == 'workflow_dispatch'
+ env:
+ TAG: ${{ steps.resolve.outputs.tag }}
+ run: |
+ git ls-remote --exit-code --tags "https://github.com/${{ github.repository }}.git" "refs/tags/$TAG" > /dev/null🤖 Prompt for AI Agents |
||
|
|
||
| # ────────────────────────────────────────────────────────────── | ||
| # GitHub Release | ||
| # ────────────────────────────────────────────────────────────── | ||
|
|
||
| create-release: | ||
| name: Create GitHub Release | ||
| needs: [setup] | ||
| if: needs.setup.outputs.dry_run != 'true' | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| steps: | ||
| - name: Generate token | ||
| id: generate_token | ||
| uses: actions/create-github-app-token@v2 | ||
| with: | ||
| app-id: ${{ secrets.GH_APP_ID }} | ||
| private-key: ${{ secrets.GH_APP_PRIVATE_KEY }} | ||
|
|
||
| - uses: actions/checkout@v4 | ||
| with: | ||
| token: ${{ steps.generate_token.outputs.token }} | ||
|
|
||
| - name: Create GitHub Release | ||
| uses: softprops/action-gh-release@v2 | ||
| with: | ||
| token: ${{ steps.generate_token.outputs.token }} | ||
| tag_name: ${{ needs.setup.outputs.tag }} | ||
| name: iii-lsp ${{ needs.setup.outputs.version }} | ||
| draft: false | ||
| prerelease: ${{ needs.setup.outputs.is_prerelease == 'true' }} | ||
| generate_release_notes: true | ||
|
|
||
| # ────────────────────────────────────────────────────────────── | ||
| # Binary Build | ||
| # ────────────────────────────────────────────────────────────── | ||
|
|
||
| binary-build: | ||
| name: Binary Release | ||
| needs: [setup, create-release] | ||
| if: ${{ !failure() && !cancelled() }} | ||
| uses: ./.github/workflows/_rust-binary.yml | ||
| with: | ||
| bin_name: iii-lsp | ||
| manifest_path: iii-lsp/Cargo.toml | ||
| tag_name: ${{ needs.setup.outputs.tag }} | ||
| is_prerelease: ${{ needs.setup.outputs.is_prerelease == 'true' }} | ||
| skip_create_release: true | ||
| dry_run: ${{ needs.setup.outputs.dry_run == 'true' }} | ||
| secrets: | ||
| GH_APP_ID: ${{ secrets.GH_APP_ID }} | ||
| GH_APP_PRIVATE_KEY: ${{ secrets.GH_APP_PRIVATE_KEY }} | ||
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.
🧩 Analysis chain
🌐 Web query:
In GitHub Actions, for top-level concurrency.group, isinputsavailable onworkflow_dispatch, and what doesgithub.refresolve to onpushvsworkflow_dispatch?💡 Result:
Is
inputsavailable in a top-levelconcurrency.grouponworkflow_dispatch?Yes. The workflow-level
concurrencykey supports expressions using thegithub,inputs, andvarscontexts, and theinputscontext is available for workflows triggered byworkflow_dispatch. [1]What does
github.refresolve to?push:github.ref/GITHUB_REFis the updated ref that was pushed (branch or tag), e.g.refs/heads/mainorrefs/tags/v1.2.3. [2]workflow_dispatch:github.ref/GITHUB_REFis the branch or tag that received the dispatch (the ref you selected in the UI or passed asrefvia the API/CLI). [3]Sources
[1] GitHub Docs – Context availability table;
concurrencysupportsgithub, inputs, vars, andinputsis available forworkflow_dispatchworkflows. (docs.github.com)[2] GitHub Docs –
pushevent:GITHUB_REFis the “Updated ref”. (docs.github.com)[3] GitHub Docs –
workflow_dispatchevent:GITHUB_REFis “Branch or tag that received dispatch”. (docs.github.com)Citations:
Use the release tag in the concurrency key instead of the workflow ref.
Line 18 keys concurrency by
github.ref. Onworkflow_dispatch, this resolves to the branch from which the dispatch was triggered (e.g.,refs/heads/main), not the release tag. The same release tag can therefore run under different concurrency groups when triggered viaworkflow_dispatchvs. a direct tag push, allowing concurrent execution instead of serialization.Proposed fix
📝 Committable suggestion
🤖 Prompt for AI Agents