From 3135eabb7c95bb5724c612cf345c703050182aa0 Mon Sep 17 00:00:00 2001 From: Jonah Braun Date: Thu, 19 Mar 2026 16:20:01 -0600 Subject: [PATCH] Add CI workflows for VSIX GitHub Releases auto-tag.yml now builds a VSIX and creates a GitHub Release on version bump. New pr-vsix.yml creates pre-releases for PR builds, with workflow_dispatch for manual testing. --- .github/workflows/auto-tag.yml | 30 +++++++++++++++- .github/workflows/pr-vsix.yml | 63 ++++++++++++++++++++++++++++++++++ 2 files changed, 92 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/pr-vsix.yml diff --git a/.github/workflows/auto-tag.yml b/.github/workflows/auto-tag.yml index 04cd2cbf3..eb409eef4 100644 --- a/.github/workflows/auto-tag.yml +++ b/.github/workflows/auto-tag.yml @@ -89,4 +89,32 @@ jobs: -d "{\"ref\":\"refs/tags/${VERSION}\",\"sha\":\"${SHA}\"}" \ "https://api.github.com/repos/${REPO}/git/refs" - echo "✅ Created tag ${VERSION} -> ${SHA}" + echo "Created tag ${VERSION} -> ${SHA}" + + - uses: actions/checkout@v4 + if: steps.version.outputs.changed == 'true' + + - uses: actions/setup-node@v4 + if: steps.version.outputs.changed == 'true' + with: + node-version: 20 + + - name: Install dependencies and build VSIX + if: steps.version.outputs.changed == 'true' + run: | + set -euo pipefail + npm install --no-audit --no-fund + npx vsce package --no-dependencies -o codex-editor-extension-${{ steps.version.outputs.version }}.vsix + + - name: Create GitHub Release with VSIX + if: steps.version.outputs.changed == 'true' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + VERSION: ${{ steps.version.outputs.version }} + run: | + set -euo pipefail + gh release create "${VERSION}" \ + "codex-editor-extension-${VERSION}.vsix" \ + --title "${VERSION}" \ + --notes "Release ${VERSION}" \ + --latest diff --git a/.github/workflows/pr-vsix.yml b/.github/workflows/pr-vsix.yml new file mode 100644 index 000000000..5793e0e51 --- /dev/null +++ b/.github/workflows/pr-vsix.yml @@ -0,0 +1,63 @@ +name: PR VSIX Build + +on: + pull_request: + branches: [main] + workflow_dispatch: + inputs: + pr_number: + description: "PR number (for manual testing)" + required: true + type: string + +permissions: + contents: write + +jobs: + build-vsix: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Determine version + id: version + run: | + set -euo pipefail + BASE_VERSION=$(jq -r '.version' package.json) + PR_NUMBER="${{ github.event.pull_request.number || inputs.pr_number }}" + PR_VERSION="${BASE_VERSION}.pr${PR_NUMBER}" + echo "version=${PR_VERSION}" >> "$GITHUB_OUTPUT" + + - name: Install dependencies and build VSIX + env: + VERSION: ${{ steps.version.outputs.version }} + run: | + set -euo pipefail + npm install --no-audit --no-fund + npx vsce package --no-dependencies -o "codex-editor-extension-${VERSION}.vsix" + + - name: Delete prior pre-release for this PR + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + VERSION: ${{ steps.version.outputs.version }} + run: | + set -euo pipefail + if gh release view "${VERSION}" >/dev/null 2>&1; then + gh release delete "${VERSION}" --yes --cleanup-tag + fi + + - name: Create pre-release with VSIX + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + VERSION: ${{ steps.version.outputs.version }} + run: | + set -euo pipefail + gh release create "${VERSION}" \ + "codex-editor-extension-${VERSION}.vsix" \ + --title "${VERSION}" \ + --notes "Pre-release build for PR #${{ github.event.pull_request.number || inputs.pr_number }}" \ + --prerelease