-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added GH actions for vscode-knative release (#350)
- update vscode 1.64.0 and added update-readme - update vscode-extension-tester Signed-off-by: msivasubramaniaan <[email protected]>
- Loading branch information
1 parent
9726171
commit 175be75
Showing
4 changed files
with
258 additions
and
208 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
name: release | ||
|
||
on: | ||
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: | ||
packaging-job: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout vscode-knative | ||
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 "@vscode/vsce" "ovsx" | ||
npm install | ||
echo "EXT_VERSION=$(cat package.json | jq -r .version)" >> $GITHUB_ENV | ||
- name: Build And Run Unit Tests | ||
uses: coactions/setup-xvfb@b6b4fcfb9f5a895edadc3bc76318fae0ac17c8b3 #v1.0.1 | ||
with: | ||
run: npm run test | ||
- name: Run UI Tests | ||
continue-on-error: true | ||
uses: coactions/setup-xvfb@b6b4fcfb9f5a895edadc3bc76318fae0ac17c8b3 #v1.0.1 | ||
with: | ||
run: npm run base-ui-test | ||
- name: Package | ||
run: | | ||
jq --tab '.extensionDependencies += [ "ms-kubernetes-tools.vscode-kubernetes-tools" ]' package.json > package.json.new | ||
mv package.json.new package.json | ||
node ./out/build/update-readme.js | ||
vsce package -o vscode-knative-${{ env.EXT_VERSION }}-${GITHUB_RUN_NUMBER}.vsix | ||
sha256sum *.vsix > vscode-knative-${{ env.EXT_VERSION }}-${GITHUB_RUN_NUMBER}.vsix.sha256 | ||
ls -lash *.vsix *.sha256 | ||
- name: Upload VSIX Artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: vscode-knative | ||
path: vscode-knative-${{ 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: | | ||
vscode-knative-${{ env.EXT_VERSION }}-${{github.run_number}}.vsix | ||
vscode-knative-${{ env.EXT_VERSION }}-${{github.run_number}}.vsix.sha256 | ||
release-job: | ||
if: ${{ inputs.publishToMarketPlace == 'true' || inputs.publishToOVSX == 'true' }} | ||
environment: ${{ 'release' }} | ||
runs-on: ubuntu-latest | ||
needs: packaging-job | ||
steps: | ||
- name: Checkout vscode-knative | ||
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 "@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: ${{ inputs.publishToMarketPlace == 'true' }} | ||
run: | | ||
vsce publish -p ${{ secrets.VSCODE_MARKETPLACE_TOKEN }} --packagePath vscode-knative/vscode-knative-${{ env.EXT_VERSION }}-${GITHUB_RUN_NUMBER}.vsix | ||
- name: Publish to OpenVSX Registry | ||
if: ${{ inputs.publishToOVSX == 'true' }} | ||
run: | | ||
ovsx publish -p ${{ secrets.OVSX_MARKETPLACE_TOKEN }} --packagePath vscode-knative/vscode-knative-${{ env.EXT_VERSION }}-${GITHUB_RUN_NUMBER}.vsix |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/*----------------------------------------------------------------------------------------------- | ||
* 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'); | ||
|
||
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions | ||
const lines = `${readme}`.split('\n'); | ||
|
||
const index = lines.findIndex((line) => line.includes('## Overview')); | ||
lines.splice(0, index + 1); | ||
writeFileSync('./README.md', lines.join('\n')); |
Oops, something went wrong.