From 2d71a584b448de22cc2ee05e575795ab67231999 Mon Sep 17 00:00:00 2001 From: msivasubramaniaan Date: Sat, 8 Jun 2024 12:47:30 +0530 Subject: [PATCH 1/6] migrated jenkin build to GH action --- .github/workflows/release.yml | 111 ++++++++++++++++++++++++++++++++++ build/update-readme.ts | 14 +++++ 2 files changed, 125 insertions(+) create mode 100644 .github/workflows/release.yml create mode 100644 build/update-readme.ts diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..1d1c45fd --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,111 @@ +name: release + +on: + workflow_dispatch: + inputs: + publishPreRelease: + description: 'Publish a pre-release ?' + required: true + type: choice + options: + - 'true' + - 'false' + default: 'false' + publishToMarketPlace: + description: 'Publish to VS Code Marketplace ?' + required: true + type: choice + options: + - 'true' + - 'false' + default: 'true' + publishToOVSX: + description: 'Publish to OpenVSX Registry ?' + required: true + type: choice + options: + - 'true' + - 'false' + default: 'true' + +jobs: + packaging-job: + runs-on: ubuntu-latest + steps: + - name: Checkout vscode-yaml + uses: actions/checkout@v4 + - name: Use Node.js + uses: actions/setup-node@v4 + with: + path: release + node-version: 20 + - name: Install dependencies + run: | + npm install -g typescript "yarn" "@vscode/vsce" "ovsx" + npm install + echo "EXT_VERSION=$(cat package.json | jq -r .version)" >> $GITHUB_ENV + - name: Build vscode-yaml + uses: coactions/setup-xvfb@b6b4fcfb9f5a895edadc3bc76318fae0ac17c8b3 #v1.0.1 + with: + run: | + yarn install + yarn run build + yarn run check-dependencies + - name: Run Unit Tests + uses: coactions/setup-xvfb@b6b4fcfb9f5a895edadc3bc76318fae0ac17c8b3 #v1.0.1 + with: + run: yarn test --silent + - name: Package + run: | + node ./out/build/update-readme.js + vsce package --target ${target} -o yaml-${{ env.EXT_VERSION }}-${GITHUB_RUN_NUMBER}-${target}.vsix + sha256sum *-${target}.vsix > yaml-${{ env.EXT_VERSION }}-${GITHUB_RUN_NUMBER}-${target}.vsix.sha256 + ls -lash *.vsix *.sha256 + - name: Upload VSIX Artifacts + uses: actions/upload-artifact@v4 + with: + name: vscode-yaml + path: yaml-${{ env.EXT_VERSION }}-${{github.run_number}}*.vsix + if-no-files-found: error + - name: Publish to GH Release Tab + if: ${{ inputs.publishToMarketPlace == 'true' && inputs.publishToOVSX == 'true' }} + uses: "marvinpinto/action-automatic-releases@919008cf3f741b179569b7a6fb4d8860689ab7f0" + with: + repo_token: "${{ secrets.GITHUB_TOKEN }}" + automatic_release_tag: "${{ env.EXT_VERSION }}" + draft: true + files: | + yaml-${{ env.EXT_VERSION }}-${{github.run_number}}*.vsix + yaml-${{ env.EXT_VERSION }}-${{github.run_number}}*.sha256 + + release-job: + if: ${{ inputs.publishToMarketPlace == 'true' || inputs.publishToOVSX == 'true' }} + environment: ${{ (inputs.publishToMarketPlace == 'true' || inputs.publishToOVSX == 'true') && 'release' || 'pre-release' }} + runs-on: ubuntu-latest + needs: packaging-job + steps: + - name: Checkout vscode-yaml + uses: actions/checkout@v4 + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + - name: Install dependencies + run: | + npm install -g typescript "yarn" "@vscode/vsce" "ovsx" + npm install + echo "EXT_VERSION=$(cat package.json | jq -r .version)" >> $GITHUB_ENV + - name: Download VSIX Artifacts + uses: actions/download-artifact@v4 + - name: Publish to VS Code Marketplace + if: ${{ github.event_name == 'schedule' || inputs.publishToMarketPlace == 'true' || inputs.publishPreRelease == 'true' }} + run: | + for platform in darwin-x64 darwin-arm64 linux-x64 win32-x64 win32-arm64; do + vsce publish -p ${{ secrets.VSCODE_MARKETPLACE_TOKEN }} --packagePath vscode-yaml/yaml-${{ env.EXT_VERSION }}-${GITHUB_RUN_NUMBER}-${platform}.vsix + done + - name: Publish to OpenVSX Registry + if: ${{ github.event_name == 'schedule' || inputs.publishToOVSX == 'true' || inputs.publishPreRelease == 'true' }} + run: | + for platform in darwin-x64 darwin-arm64 linux-x64 win32-x64 win32-arm64; do + ovsx publish -p ${{ secrets.OVSX_MARKETPLACE_TOKEN }} --packagePath vscode-yaml/yaml-${{ env.EXT_VERSION }}-${GITHUB_RUN_NUMBER}-${platform}.vsix + done diff --git a/build/update-readme.ts b/build/update-readme.ts new file mode 100644 index 00000000..a216b53e --- /dev/null +++ b/build/update-readme.ts @@ -0,0 +1,14 @@ +/*----------------------------------------------------------------------------------------------- + * Copyright (c) Red Hat, Inc. All rights reserved. + * Licensed under the MIT License. See LICENSE file in the project root for license information. + *-----------------------------------------------------------------------------------------------*/ + +import { readFileSync, writeFileSync } from 'fs-extra'; + +const readme = readFileSync('./README.md'); + +const lines = `${readme}`.split('\n'); + +const index = lines.findIndex((line) => line.includes('## Overview')); +lines.splice(0, index + 1); +writeFileSync('./README.md', lines.join('\n')); From 4683fb9226cc0e7dd77c8a12510d0607330c56b4 Mon Sep 17 00:00:00 2001 From: msivasubramaniaan Date: Sat, 8 Jun 2024 13:01:53 +0530 Subject: [PATCH 2/6] published global specific --- .github/workflows/release.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1d1c45fd..3871f08c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -100,12 +100,8 @@ jobs: - name: Publish to VS Code Marketplace if: ${{ github.event_name == 'schedule' || inputs.publishToMarketPlace == 'true' || inputs.publishPreRelease == 'true' }} run: | - for platform in darwin-x64 darwin-arm64 linux-x64 win32-x64 win32-arm64; do vsce publish -p ${{ secrets.VSCODE_MARKETPLACE_TOKEN }} --packagePath vscode-yaml/yaml-${{ env.EXT_VERSION }}-${GITHUB_RUN_NUMBER}-${platform}.vsix - done - name: Publish to OpenVSX Registry if: ${{ github.event_name == 'schedule' || inputs.publishToOVSX == 'true' || inputs.publishPreRelease == 'true' }} run: | - for platform in darwin-x64 darwin-arm64 linux-x64 win32-x64 win32-arm64; do ovsx publish -p ${{ secrets.OVSX_MARKETPLACE_TOKEN }} --packagePath vscode-yaml/yaml-${{ env.EXT_VERSION }}-${GITHUB_RUN_NUMBER}-${platform}.vsix - done From 2bc743fa0e8fe7cb1c7d173176f583fe0d559249 Mon Sep 17 00:00:00 2001 From: msivasubramaniaan Date: Sat, 8 Jun 2024 13:12:30 +0530 Subject: [PATCH 3/6] renamed yaml to vscode-yaml --- .github/workflows/release.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3871f08c..5f8cc5b7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -58,14 +58,14 @@ jobs: - name: Package run: | node ./out/build/update-readme.js - vsce package --target ${target} -o yaml-${{ env.EXT_VERSION }}-${GITHUB_RUN_NUMBER}-${target}.vsix - sha256sum *-${target}.vsix > yaml-${{ env.EXT_VERSION }}-${GITHUB_RUN_NUMBER}-${target}.vsix.sha256 + vsce package -o vscode-yaml-${{ env.EXT_VERSION }}-${GITHUB_RUN_NUMBER}-${target}.vsix + sha256sum *-${target}.vsix > vscode-yaml-${{ env.EXT_VERSION }}-${GITHUB_RUN_NUMBER}-${target}.vsix.sha256 ls -lash *.vsix *.sha256 - name: Upload VSIX Artifacts uses: actions/upload-artifact@v4 with: name: vscode-yaml - path: yaml-${{ env.EXT_VERSION }}-${{github.run_number}}*.vsix + path: vscode-yaml-${{ env.EXT_VERSION }}-${{github.run_number}}*.vsix if-no-files-found: error - name: Publish to GH Release Tab if: ${{ inputs.publishToMarketPlace == 'true' && inputs.publishToOVSX == 'true' }} @@ -75,8 +75,8 @@ jobs: automatic_release_tag: "${{ env.EXT_VERSION }}" draft: true files: | - yaml-${{ env.EXT_VERSION }}-${{github.run_number}}*.vsix - yaml-${{ env.EXT_VERSION }}-${{github.run_number}}*.sha256 + vscode-yaml-${{ env.EXT_VERSION }}-${{github.run_number}}*.vsix + vscode-yaml-${{ env.EXT_VERSION }}-${{github.run_number}}*.sha256 release-job: if: ${{ inputs.publishToMarketPlace == 'true' || inputs.publishToOVSX == 'true' }} @@ -100,8 +100,8 @@ jobs: - name: Publish to VS Code Marketplace if: ${{ github.event_name == 'schedule' || inputs.publishToMarketPlace == 'true' || inputs.publishPreRelease == 'true' }} run: | - vsce publish -p ${{ secrets.VSCODE_MARKETPLACE_TOKEN }} --packagePath vscode-yaml/yaml-${{ env.EXT_VERSION }}-${GITHUB_RUN_NUMBER}-${platform}.vsix + vsce publish -p ${{ secrets.VSCODE_MARKETPLACE_TOKEN }} --packagePath vscode-yaml/vscode-yaml-${{ env.EXT_VERSION }}-${GITHUB_RUN_NUMBER}-${platform}.vsix - name: Publish to OpenVSX Registry if: ${{ github.event_name == 'schedule' || inputs.publishToOVSX == 'true' || inputs.publishPreRelease == 'true' }} run: | - ovsx publish -p ${{ secrets.OVSX_MARKETPLACE_TOKEN }} --packagePath vscode-yaml/yaml-${{ env.EXT_VERSION }}-${GITHUB_RUN_NUMBER}-${platform}.vsix + ovsx publish -p ${{ secrets.OVSX_MARKETPLACE_TOKEN }} --packagePath vscode-yaml/vscode-yaml-${{ env.EXT_VERSION }}-${GITHUB_RUN_NUMBER}-${platform}.vsix From 72188056c4622b161d517f098ea552017f627037 Mon Sep 17 00:00:00 2001 From: msivasubramaniaan Date: Tue, 11 Jun 2024 11:42:08 +0530 Subject: [PATCH 4/6] addressed review comments --- .github/workflows/release.yml | 5 ++--- build/update-readme.ts | 14 -------------- 2 files changed, 2 insertions(+), 17 deletions(-) delete mode 100644 build/update-readme.ts diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5f8cc5b7..1fa043fe 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -57,9 +57,8 @@ jobs: run: yarn test --silent - name: Package run: | - node ./out/build/update-readme.js - vsce package -o vscode-yaml-${{ env.EXT_VERSION }}-${GITHUB_RUN_NUMBER}-${target}.vsix - sha256sum *-${target}.vsix > vscode-yaml-${{ env.EXT_VERSION }}-${GITHUB_RUN_NUMBER}-${target}.vsix.sha256 + vsce package -o vscode-yaml-${{ env.EXT_VERSION }}-${GITHUB_RUN_NUMBER}.vsix + sha256sum *.vsix > vscode-yaml-${{ env.EXT_VERSION }}-${GITHUB_RUN_NUMBER}.vsix.sha256 ls -lash *.vsix *.sha256 - name: Upload VSIX Artifacts uses: actions/upload-artifact@v4 diff --git a/build/update-readme.ts b/build/update-readme.ts deleted file mode 100644 index a216b53e..00000000 --- a/build/update-readme.ts +++ /dev/null @@ -1,14 +0,0 @@ -/*----------------------------------------------------------------------------------------------- - * Copyright (c) Red Hat, Inc. All rights reserved. - * Licensed under the MIT License. See LICENSE file in the project root for license information. - *-----------------------------------------------------------------------------------------------*/ - -import { readFileSync, writeFileSync } from 'fs-extra'; - -const readme = readFileSync('./README.md'); - -const lines = `${readme}`.split('\n'); - -const index = lines.findIndex((line) => line.includes('## Overview')); -lines.splice(0, index + 1); -writeFileSync('./README.md', lines.join('\n')); From 3534ae7c584869d9a6b3268aaf380fff89ae5a96 Mon Sep 17 00:00:00 2001 From: msivasubramaniaan Date: Tue, 11 Jun 2024 11:43:35 +0530 Subject: [PATCH 5/6] removed platform tag --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1fa043fe..ce7e35a2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -99,8 +99,8 @@ jobs: - name: Publish to VS Code Marketplace if: ${{ github.event_name == 'schedule' || inputs.publishToMarketPlace == 'true' || inputs.publishPreRelease == 'true' }} run: | - vsce publish -p ${{ secrets.VSCODE_MARKETPLACE_TOKEN }} --packagePath vscode-yaml/vscode-yaml-${{ env.EXT_VERSION }}-${GITHUB_RUN_NUMBER}-${platform}.vsix + vsce publish -p ${{ secrets.VSCODE_MARKETPLACE_TOKEN }} --packagePath vscode-yaml/vscode-yaml-${{ env.EXT_VERSION }}-${GITHUB_RUN_NUMBER}.vsix - name: Publish to OpenVSX Registry if: ${{ github.event_name == 'schedule' || inputs.publishToOVSX == 'true' || inputs.publishPreRelease == 'true' }} run: | - ovsx publish -p ${{ secrets.OVSX_MARKETPLACE_TOKEN }} --packagePath vscode-yaml/vscode-yaml-${{ env.EXT_VERSION }}-${GITHUB_RUN_NUMBER}-${platform}.vsix + ovsx publish -p ${{ secrets.OVSX_MARKETPLACE_TOKEN }} --packagePath vscode-yaml/vscode-yaml-${{ env.EXT_VERSION }}-${GITHUB_RUN_NUMBER}.vsix From 750e8c63172214b0851268c5bfd998f845e1d5e7 Mon Sep 17 00:00:00 2001 From: msivasubramaniaan Date: Tue, 11 Jun 2024 18:21:24 +0530 Subject: [PATCH 6/6] removed npm install --- .github/workflows/release.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ce7e35a2..db31e0c4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -42,7 +42,6 @@ jobs: - name: Install dependencies run: | npm install -g typescript "yarn" "@vscode/vsce" "ovsx" - npm install echo "EXT_VERSION=$(cat package.json | jq -r .version)" >> $GITHUB_ENV - name: Build vscode-yaml uses: coactions/setup-xvfb@b6b4fcfb9f5a895edadc3bc76318fae0ac17c8b3 #v1.0.1 @@ -92,7 +91,6 @@ jobs: - name: Install dependencies run: | npm install -g typescript "yarn" "@vscode/vsce" "ovsx" - npm install echo "EXT_VERSION=$(cat package.json | jq -r .version)" >> $GITHUB_ENV - name: Download VSIX Artifacts uses: actions/download-artifact@v4