From da20c04c53d019bd86288e4f71a0b022174d6173 Mon Sep 17 00:00:00 2001 From: Rob Stryker Date: Fri, 4 Oct 2024 12:43:31 -0400 Subject: [PATCH] Attempt a release action Signed-off-by: Rob Stryker --- .github/workflows/gh-actions.yml | 72 +++++++++++++++++++++++++++++++- 1 file changed, 70 insertions(+), 2 deletions(-) diff --git a/.github/workflows/gh-actions.yml b/.github/workflows/gh-actions.yml index 6e65e21..904cc37 100644 --- a/.github/workflows/gh-actions.yml +++ b/.github/workflows/gh-actions.yml @@ -6,7 +6,23 @@ on: pull_request: branches: [master] workflow_dispatch: - + inputs: + publishToMarketPlace: + description: 'Publish to VS Code Marketplace ?' + required: true + type: choice + options: + - 'true' + - 'false' + default: 'false' + publishToOVSX: + description: 'Publish to OpenVSX Registry ?' + required: true + type: choice + options: + - 'true' + - 'false' + default: 'false' jobs: test: runs-on: ${{ matrix.os }} # runs a test on Ubuntu, Windows and macOS @@ -59,4 +75,56 @@ jobs: uses: codecov/codecov-action@v4 with: file: ./coverage/coverage-final.json - + + packaging-job: + runs-on: ubuntu-latest + needs: should-build-change + if: ${{ needs.should-build-change.outputs.repo-cache-hit != 'true' || github.event_name != 'schedule' }} + steps: + - name: Set Up NodeJS + uses: actions/setup-node@v4 + with: + node-version: '18' + - name: Install NodeJS dependencies + run: npm install -g typescript "@vscode/vsce" "ovsx" + - name: Build vscode-server-connector + - run: npm install + - run: npm run build + + - name: Package vscode-server-connector + run: | + vsce package + ls -lash *.vsix + - name: Upload VSIX Artifacts + uses: actions/upload-artifact@v4 + with: + name: vscode-server-connector + path: | + *.vsix + if-no-files-found: error + release-job: + environment: ${{ (inputs.publishToMarketPlace == 'true' || inputs.publishToOVSX == 'true') && 'release' }} + runs-on: ubuntu-latest + needs: packaging-job + steps: + - name: Set Up NodeJS + uses: actions/setup-node@v4 + with: + node-version: '18' + - name: Install dependencies + run: | + npm install -g typescript "@vscode/vsce" "ovsx" + - name: Download VSIX + uses: actions/download-artifact@v4 + - name: Publish to VS Code Marketplace + if: ${{ inputs.publishToMarketPlace == 'true' }} + run: | + for platformVsix in *.vsix; do + vsce publish --skip-duplicate -p ${{ secrets.VSCODE_MARKETPLACE_TOKEN }} --packagePath ${platformVsix} + done + - name: Publish to OpenVSX Registry + if: ${{ inputs.publishToOVSX == 'true' }} + run: | + for platformVsix in *.vsix; do + ovsx publish --skip-duplicate -p ${{ secrets.OVSX_MARKETPLACE_TOKEN }} --packagePath ${platformVsix} + done