Publish extensions to open-vsx.org #1920
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 extensions to open-vsx.org | |
on: | |
schedule: | |
# Run at 03:03 UTC every day. | |
- cron: "3 3 * * 1-5" | |
workflow_dispatch: | |
inputs: | |
extensions: | |
description: "Comma separated list of extensions to publish" | |
required: false | |
default: "" | |
skipPublish: | |
description: "Skip publishing to Open VSX, only build extensions" | |
type: boolean | |
required: false | |
default: false | |
forcefullyPublish: | |
description: "Force publish to Open VSX, even if version is already published" | |
type: boolean | |
required: false | |
default: false | |
jobs: | |
publish_extensions: | |
env: | |
EXTENSIONS: ${{ github.event.inputs.extensions }} | |
SKIP_PUBLISH: ${{ github.event.inputs.skipPublish }} | |
FORCE: ${{ github.event.inputs.forcefullyPublish }} | |
name: Publish Extensions | |
runs-on: ubuntu-latest | |
permissions: | |
actions: write | |
contents: read | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/[email protected] | |
with: | |
node-version: "20.x" | |
- run: npm install | |
- run: npm i -g @vscode/vsce pnpm | |
- uses: actions/github-script@v7 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
REPOSITORY: ${{ github.repository }} | |
with: | |
script: | | |
const script = require('./scripts/publish-extensions.js'); | |
await script(async (extension, context) => { | |
const [owner, repo] = process.env.REPOSITORY.split("/"); | |
await github.request("POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches", { | |
owner, | |
repo, | |
workflow_id: "publish-extension.yml", | |
ref: "master", | |
inputs: { | |
extension: JSON.stringify(extension), | |
publishContext: JSON.stringify(context), | |
force: process.env.FORCE, | |
skipPublish: process.env.SKIP_PUBLISH, | |
}, | |
headers: { | |
"X-GitHub-Api-Version": "2022-11-28", | |
}, | |
}); | |
}); | |
# TODO fix reporting | |
# - name: Report results | |
# run: bun run ./report-extensions.ts | |
# - uses: actions/upload-artifact@v4 | |
# if: always() | |
# with: | |
# name: report | |
# path: | | |
# /tmp/stat.json | |
# /tmp/result.md | |
# - uses: actions/upload-artifact@v4 | |
# if: always() | |
# with: | |
# name: artifacts | |
# path: | | |
# /tmp/artifacts/*.vsix | |
# - name: Upload job summary | |
# if: always() | |
# run: cat /tmp/result.md >> $GITHUB_STEP_SUMMARY | |
# - name: Get previous job's status | |
# id: lastrun | |
# uses: filiptronicek/get-last-job-status@main | |
# - name: Slack Notification | |
# if: ${{ !github.event.inputs.extensions && ((success() && steps.lastrun.outputs.status == 'failed') || failure()) }} | |
# uses: rtCamp/action-slack-notify@v2 | |
# env: | |
# SLACK_WEBHOOK: ${{ secrets.GITPOD_SLACK_WEBHOOK }} | |
# SLACK_COLOR: ${{ job.status }} | |
check_parity: | |
name: Check MS parity | |
runs-on: ubuntu-latest | |
needs: publish_extensions | |
permissions: | |
actions: none | |
if: ${{ !github.event.inputs.extensions }} # only run on full runs | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/[email protected] | |
with: | |
node-version: "18.x" | |
- run: npm install | |
- name: Check parity of the top 4096 extensions | |
run: node lib/reportStat.js |