-
Notifications
You must be signed in to change notification settings - Fork 223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
migrated jenkin build to GH action #1033
Changes from 3 commits
2d71a58
4683fb9
2bc743f
7218805
3534ae7
750e8c6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Given this project uses yarn, we should use yarn to install dependencies. In the next step, on line 55, you run yarn install, so I think it should be okay to remove this line (just line 45, we still need line 44). |
||
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 -o vscode-yaml-${{ env.EXT_VERSION }}-${GITHUB_RUN_NUMBER}-${target}.vsix | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
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: 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' }} | ||
uses: "marvinpinto/action-automatic-releases@919008cf3f741b179569b7a6fb4d8860689ab7f0" | ||
with: | ||
repo_token: "${{ secrets.GITHUB_TOKEN }}" | ||
automatic_release_tag: "${{ env.EXT_VERSION }}" | ||
draft: true | ||
files: | | ||
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' }} | ||
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: | | ||
vsce publish -p ${{ secrets.VSCODE_MARKETPLACE_TOKEN }} --packagePath vscode-yaml/vscode-yaml-${{ env.EXT_VERSION }}-${GITHUB_RUN_NUMBER}-${platform}.vsix | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
- 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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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')); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The README doesn't contain the heading "Overview", so this does nothing. I think it's worth removing this build script, as well as line 60 in the GitHub Action which calls this script. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In fact |
||
lines.splice(0, index + 1); | ||
writeFileSync('./README.md', lines.join('\n')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would remove this. We don't support pre-releases here either, and the logic to do it is missing anyways.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We did support prerelease
YAML
inJenkins
earlier