Skip to content

Commit

Permalink
Migrate Jenkins release build to GitHub Actions.
Browse files Browse the repository at this point in the history
Signed-off-by: Roland Grunberg <rgrunber@redhat.com>
  • Loading branch information
rgrunber committed Aug 9, 2023
1 parent 7dccf83 commit f95355a
Showing 1 changed file with 113 additions and 0 deletions.
113 changes: 113 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
name: release

on:
workflow_dispatch:
inputs:
publishPreRelease:
description: 'Publish a pre-release ?'
required: true
type: choice
options:
- 'true'
- 'false'
default: 'true'
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-openshift-tools
uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 16
- name: Install dependencies
run: |
npm install -g typescript "vsce" "ovsx"
npm install
echo "EXT_VERSION=$(cat package.json | jq -r .version)" >> $GITHUB_ENV
- name: Compile
run: npm run compile
- 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
declare -A targets
targets["win32-x64"]=win32
targets["win32-arm64"]=win32
targets["linux-x64"]=linux
targets["darwin-x64"]=darwin
targets["darwin-arm64"]=darwin
for target in ${!targets[@]}; do
export TARGET=${targets[${target}]}
vsce package --target ${target} -o openshift-toolkit-${{ env.EXT_VERSION }}-${GITHUB_RUN_NUMBER}-${target}.vsix
sha256sum *-${target}.vsix > openshift-toolkit-${{ env.EXT_VERSION }}-${GITHUB_RUN_NUMBER}-${target}.vsix.sha256
done
ls -lash *.vsix *.sha256
- name: Upload VSIX Artifacts
uses: actions/upload-artifact@v2
with:
name: openshift-toolkit
path: openshift-toolkit*-${{ 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: |
openshift-toolkit-${{ env.EXT_VERSION }}-${{github.run_number}}*.vsix
openshift-toolkit-${{ env.EXT_VERSION }}-${{github.run_number}}*.sha256
release-job:
environment: ${{ (inputs.publishToMarketPlace == 'true' || inputs.publishToOVSX == 'true') && 'release' || 'pre-release' }}
runs-on: ubuntu-latest
needs: packaging-job
steps:
- name: Checkout vscode-openshift-tools
uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 16
- name: Install dependencies
run: |
npm install -g typescript "vsce" "ovsx"
echo "EXT_VERSION=$(cat package.json | jq -r .version)" >> $GITHUB_ENV
- name: Download VSIX Artifacts
uses: actions/download-artifact@v3
- 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
echo vsce publish -p ${{ secrets.VSCODE_MARKETPLACE_TOKEN }} --packagePath openshift-toolkit-${{ 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
echo ovsx publish -p ${{ secrets.OVSX_MARKETPLACE_TOKEN }} --packagePath openshift-toolkit-${{ env.EXT_VERSION }}-${GITHUB_RUN_NUMBER}-${platform}.vsix
done

0 comments on commit f95355a

Please sign in to comment.