Skip to content
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

Migrate Jenkins release job to GitHub Actions. #184

Merged
merged 1 commit into from
Mar 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
160 changes: 160 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
name: release

on:
schedule:
- cron: "0 8 * * *"
workflow_dispatch:
inputs:
LSP4MP_TAG:
description: "branch/tag of LSP4MP to build."
type: string
default: master
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:
should-build-change:
runs-on: ubuntu-latest
outputs:
repo-cache-hit: ${{ steps.cache-last-commit.outputs.cache-hit }}
steps:
- uses: actions/checkout@v4
with:
repository: "eclipse/lsp4mp"
fetch-depth: 2
path: lsp4mp
- uses: actions/checkout@v4
with:
repository: "redhat-developer/vscode-microprofile"
fetch-depth: 2
path: vscode-microprofile
- run: |
pushd lsp4mp
git rev-parse HEAD >> ../lastCommit
popd
pushd vscode-microprofile
git rev-parse HEAD >> ../lastCommit
- name: Check New Changes
id: cache-last-commit
uses: actions/cache@v4
with:
path: lastCommit
key: lastCommit-${{ hashFiles('lastCommit') }}
packaging-job:
runs-on: ubuntu-latest
needs: should-build-change
if: ${{ needs.should-build-change.outputs.repo-cache-hit != 'true' || github.event_name != 'schedule' }}
datho7561 marked this conversation as resolved.
Show resolved Hide resolved
steps:
- name: Checkout LSP4MP
uses: actions/checkout@v4
with:
repository: eclipse/lsp4mp
ref: ${{ inputs.LSP4MP_TAG }}
path: lsp4mp
- name: Cache Maven local repository
uses: actions/cache@v4
with:
path: |
~/.m2/repository
~/.m2/wrapper
!~/.m2/repository/org/eclipse/lsp4mp
key: maven-local-${{ hashFiles('**/pom.xml') }}
- name: Set Up Java
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'adopt'
- name: Check Out VS Code MicroProfile
uses: actions/checkout@v4
with:
path: vscode-microprofile
- 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 Extension
run: |
pushd vscode-microprofile
echo "EXT_VERSION=$(cat package.json | jq -r .version)" >> $GITHUB_ENV
npm install
npm run build
npm run vscode:prepublish
- name: Test vscode-microprofile
env:
SKIP_COMMANDS_TEST: true
SKIP_CLASSPATH_TEST: true
run: |
$(echo "xvfb-run --auto-servernum") npm run test --silent
continue-on-error: true
- name: Prepare Pre-Release
if: ${{ github.event_name == 'schedule' || inputs.publishPreRelease == 'true' }}
run: |
pushd vscode-microprofile
npx gulp prepare_pre_release
echo "publishPreReleaseFlag=--pre-release" >> $GITHUB_ENV
- name: Package vscode-microprofile
run: |
pushd vscode-microprofile
vsce package ${{ env.publishPreReleaseFlag }} -o ../vscode-microprofile-${{ env.EXT_VERSION }}-${GITHUB_RUN_NUMBER}.vsix
- name: Upload VSIX Artifacts
uses: actions/upload-artifact@v4
with:
name: vscode-microprofile
path: |
vscode-microprofile-${{ 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 }}"
title: "${{ env.EXT_VERSION }}"
draft: true
files: |
vscode-microprofile-${{ env.EXT_VERSION }}-${{ github.run_number }}.vsix
release-job:
environment: ${{ (inputs.publishToMarketPlace == 'true' || inputs.publishToOVSX == 'true') && 'release' || 'pre-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: ${{ github.event_name == 'schedule' || inputs.publishToMarketPlace == 'true' || inputs.publishPreRelease == 'true' }}
run: |
vsce publish -p ${{ secrets.VSCODE_MARKETPLACE_TOKEN }} --packagePath vscode-microprofile/vscode-microprofile-*-${GITHUB_RUN_NUMBER}.vsix
- name: Publish to OpenVSX Registry
if: ${{ github.event_name == 'schedule' || inputs.publishToOVSX == 'true' || inputs.publishPreRelease == 'true' }}
run: |
ovsx publish --skip-duplicate -p ${{ secrets.OVSX_MARKETPLACE_TOKEN }} --packagePath vscode-microprofile/vscode-microprofile-*-${GITHUB_RUN_NUMBER}.vsix
Loading