From 38e3168cc2a00d94a398953787f4145b85b5a911 Mon Sep 17 00:00:00 2001 From: hongjr03 Date: Tue, 17 Nov 2026 15:31:24 +0800 Subject: [PATCH] ci: publish only to Open VSX and fix production docs deploy VS Code Marketplace publication is now manual: drop the vsce step and the VSCE_PAT requirement, and keep Open VSX automated. Add a workflow_dispatch entry point that republishes artifacts from an existing run so a failed publish can be retried without cutting a new release. Production docs could not deploy: ossutil 1.7 rejects --include/--exclude patterns containing directory separators (getFilter splits the pattern and fails), so 'preview/*' and 'staging/*' were invalid and the whole step errored out. Sync every production top-level entry instead: --delete then stays scoped to production paths and the preview/staging prefixes survive. Also expose the docs deploy as workflow_dispatch(tag) to redeploy an existing tag. --- .github/workflows/publish-docs.yml | 24 ++++++++++++++- .github/workflows/publish-vsix.yml | 47 +++++++++++++++++------------- .github/workflows/release.yml | 2 +- 3 files changed, 51 insertions(+), 22 deletions(-) diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml index a94409904..1e60e2582 100644 --- a/.github/workflows/publish-docs.yml +++ b/.github/workflows/publish-docs.yml @@ -1,6 +1,12 @@ name: Publish production docs on: + workflow_dispatch: + inputs: + tag: + description: Tag whose documentation is deployed to production + required: true + type: string workflow_call: inputs: tag: @@ -56,7 +62,23 @@ jobs: endpoint: ${{ secrets.endpoint }} access-key-id: ${{ secrets.accessKeyId }} access-key-secret: ${{ secrets.accessKeySecret }} + # ossutil 1.7 matches --include/--exclude against file names only: patterns that + # contain a directory separator are rejected outright. A whole-root sync with + # --delete would therefore remove the preview/ and staging/ prefixes owned by + # the preview deployment, so sync every production top-level entry instead. + # --delete then stays scoped to production paths; stale top-level entries are + # the only thing a removed build output would leave behind. - name: Deploy production documentation env: BUCKET: ${{ secrets.bucketName }} - run: ossutil sync website/site/dist/ "oss://${BUCKET}/" --delete --exclude 'preview/*' --exclude 'staging/*' -f --disable-ignore-error + run: | + set -euo pipefail + cd website/site/dist + shopt -s nullglob dotglob + for entry in *; do + if [ -d "${entry}" ]; then + ossutil sync "${entry}/" "oss://${BUCKET}/${entry}/" --delete -f --disable-ignore-error + else + ossutil cp -f "${entry}" "oss://${BUCKET}/${entry}" --disable-ignore-error + fi + done diff --git a/.github/workflows/publish-vsix.yml b/.github/workflows/publish-vsix.yml index 56fec1dbd..8a3815d67 100644 --- a/.github/workflows/publish-vsix.yml +++ b/.github/workflows/publish-vsix.yml @@ -1,14 +1,26 @@ -name: Publish VSIX +name: Publish VSIX to Open VSX on: + workflow_dispatch: + inputs: + source-ref: + description: Git ref the VSIX artifacts were built from + required: true + type: string + run-id: + description: Actions run id that produced the vsix-* artifacts + required: true + type: string workflow_call: inputs: source-ref: required: true type: string + run-id: + description: Optional run id to republish artifacts from; defaults to the caller run + required: false + type: string secrets: - VSCE_PAT: - required: true OPEN_VSX_TOKEN: required: true @@ -18,12 +30,9 @@ permissions: jobs: publish: - name: Publish VSIX packages + name: Publish VSIX packages to Open VSX runs-on: ubuntu-latest environment: vscode-marketplaces - defaults: - run: - working-directory: editors/vscode steps: - uses: actions/checkout@v4 with: @@ -32,29 +41,27 @@ jobs: uses: actions/setup-node@v4 with: node-version: 22 - cache: npm - cache-dependency-path: editors/vscode/package-lock.json - - name: Install extension dependencies - run: npm ci - name: Download VSIX packages uses: actions/download-artifact@v4 with: pattern: vsix-* path: artifacts merge-multiple: true - - name: Publish to VS Code Marketplace - env: - VSCE_PAT: ${{ secrets.VSCE_PAT }} - run: | - set -euo pipefail - for vsix in ../../artifacts/*.vsix; do - node node_modules/@vscode/vsce/vsce publish --packagePath "${vsix}" - done + run-id: ${{ inputs.run-id || github.run_id }} + github-token: ${{ secrets.GITHUB_TOKEN }} + # The VS Code Marketplace publication is done manually by a maintainer; + # only Open VSX is automated here. - name: Publish to Open VSX env: OPEN_VSX_TOKEN: ${{ secrets.OPEN_VSX_TOKEN }} run: | set -euo pipefail - for vsix in ../../artifacts/*.vsix; do + shopt -s nullglob + vsix_files=(artifacts/*.vsix) + if [ "${#vsix_files[@]}" -eq 0 ]; then + echo "no VSIX packages found for run ${{ inputs.run-id || github.run_id }}" >&2 + exit 1 + fi + for vsix in "${vsix_files[@]}"; do npx --yes ovsx@1.1.1 publish "${vsix}" -p "${OPEN_VSX_TOKEN}" done diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2724fa4d0..31b43f524 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -113,7 +113,7 @@ jobs: artifacts/* publish-marketplaces: - name: Publish extension marketplaces + name: Publish extension to Open VSX if: ${{ !inputs.dry-run && needs.validate.outputs.channel == 'stable' }} needs: [validate, build, publish-github] uses: ./.github/workflows/publish-vsix.yml