Skip to content

Test and create release (when run manually) #1503

Test and create release (when run manually)

Test and create release (when run manually) #1503

Workflow file for this run

# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright (c) 2011-2021 ETH Zurich.
name: Test and create release (when run manually)
on:
push: # run this workflow on every push
pull_request: # run this workflow on every pull_request
workflow_dispatch: # allow to manually trigger this workflow
inputs:
type:
type: choice
description: 'Specifies whether a stable release, nightly release or release candidate should be triggered.'
required: true
default: 'nightly'
options:
- stable
- nightly
- rc
viperserver_tag_name:
description: 'Tag name of ViperServer release from which server JAR should be downloaded'
required: true
boogie_tag_name:
description: 'Tag name of Boogie release from which the Boogie binaries should be downloaded. Can be set to be "latest"'
required: true
default: 'latest'
z3_version:
description: 'Z3 version that should be downloaded and included in a release'
required: true
default: '4.8.7'
tag_name:
description: 'Tag name for stable release.'
required: true
default: '-'
release_name:
description: 'Release title for stable release.'
required: true
default: '-'
# note that release-candidate builds are treated like 'stable' builds for now except that there is no deployment to the marketplaces in the end.
# in the future, this should be changed such that release-candidates result in a prerelease (like nightly builds).
# the following env variables configure the behavior of this workflow
# in particular, they control whether Viper-IDE is tested against certain ViperTools and a ViperServer JAR on push and pull requests
# this is particularly useful during debugging / testing as a new Viper-IDE release is not necessary for every change to the ViperServer JAR
env:
TEST_LOCAL_ON_PUSH_PR: false
# note that the following URL is extended with `/${{ matrix.viper-tools-zip-file }}` in the 'build-and-test' job:
TEST_LOCAL_ON_PUSH_PR_VIPERTOOLS_URL: https://github.com/viperproject/viper-ide/releases/download/v-2022-09-21-1611
# the following URL is not extended and downloading the destination is expected to return the viperserver.jar:
TEST_LOCAL_ON_PUSH_PR_VIPERSERVER_URL: https://polybox.ethz.ch/index.php/s/54sDcqHDJHelKBY/download
jobs:
create-viper-tools:
if: github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
env:
VIPERSERVER_URL: "https://github.com/viperproject/viperserver/releases/download/${{ github.event.inputs.viperserver_tag_name }}/viperserver.jar"
WIN_Z3_URL: "https://github.com/Z3Prover/z3/releases/download/z3-${{ github.event.inputs.z3_version }}/z3-${{ github.event.inputs.z3_version }}-x64-win.zip"
LINUX_Z3_URL: "https://github.com/Z3Prover/z3/releases/download/z3-${{ github.event.inputs.z3_version }}/z3-${{ github.event.inputs.z3_version }}-x64-ubuntu-16.04.zip"
MAC_Z3_URL: "https://github.com/Z3Prover/z3/releases/download/z3-${{ github.event.inputs.z3_version }}/z3-${{ github.event.inputs.z3_version }}-x64-osx-10.14.6.zip"
# The non-'4.8.7' URL will only work for '4.9.0' and above (such a version would break the above two URLs though, since they now build for `osx-10.16` and `glibc-2.35`)
MAC_ARM_Z3_URL: ${{ github.event.inputs.z3_version == '4.8.7' && 'https://github.com/viperproject/boogie-builder/raw/master/prebuilt_z3/z3-4.8.7-arm64-osx.zip' || format('https://github.com/Z3Prover/z3/releases/download/z3-{0}/z3-{0}-arm64-osx-11.zip', github.event.inputs.z3_version) }}
# we fake a ternary operator `a ? b : c` by using `a && b || c` as mentioned here:
# https://github.com/actions/runner/issues/409
WIN_BOOGIE_URL: ${{ github.event.inputs.boogie_tag_name == 'latest' && 'https://github.com/viperproject/boogie-builder/releases/latest/download/boogie-win.zip' || format('https://github.com/viperproject/boogie-builder/releases/download/{0}/boogie-win.zip', github.event.inputs.boogie_tag_name) }}
LINUX_BOOGIE_URL: ${{ github.event.inputs.boogie_tag_name == 'latest' && 'https://github.com/viperproject/boogie-builder/releases/latest/download/boogie-linux.zip' || format('https://github.com/viperproject/boogie-builder/releases/download/{0}/boogie-linux.zip', github.event.inputs.boogie_tag_name) }}
MAC_BOOGIE_URL: ${{ github.event.inputs.boogie_tag_name == 'latest' && 'https://github.com/viperproject/boogie-builder/releases/latest/download/boogie-osx.zip' || format('https://github.com/viperproject/boogie-builder/releases/download/{0}/boogie-osx.zip', github.event.inputs.boogie_tag_name) }}
MAC_ARM_BOOGIE_URL: ${{ github.event.inputs.boogie_tag_name == 'latest' && 'https://github.com/viperproject/boogie-builder/releases/latest/download/boogie-osx-arm.zip' || format('https://github.com/viperproject/boogie-builder/releases/download/{0}/boogie-osx-arm.zip', github.event.inputs.boogie_tag_name) }}
VIPER_IDE_DEPS_REF: "master"
steps:
- name: Install prerequisites
run: sudo apt-get install curl zip unzip
- name: Create ViperTools folders
run: |
mkdir ViperToolsWin
mkdir ViperToolsLinux
mkdir ViperToolsMac
mkdir ViperToolsMacARM
- name: Clone ViperTools template
uses: actions/checkout@v4
with:
repository: viperproject/viper-ide-deps
ref: ${{ env.VIPER_IDE_DEPS_REF }}
path: template
- name: Remove .git folder from template and use template
run: |
rm -r template/.git
cp -r template/* ViperToolsWin
cp -r template/* ViperToolsLinux
cp -r template/* ViperToolsMac
cp -r template/* ViperToolsMacARM
- name: Download ViperServer fat JAR
run: curl -L --silent --show-error --fail ${{ env.VIPERSERVER_URL }} --output viperserver.jar
- name: Copy ViperServer fat JAR to ViperTools
run: |
cp viperserver.jar ViperToolsWin/backends
cp viperserver.jar ViperToolsLinux/backends
cp viperserver.jar ViperToolsMac/backends
cp viperserver.jar ViperToolsMacARM/backends
- name: Download Z3
run: |
curl --fail --silent --show-error -L ${{ env.WIN_Z3_URL }} --output z3-win.zip
curl --fail --silent --show-error -L ${{ env.LINUX_Z3_URL }} --output z3-linux.zip
curl --fail --silent --show-error -L ${{ env.MAC_Z3_URL }} --output z3-mac.zip
curl --fail --silent --show-error -L ${{ env.MAC_ARM_Z3_URL }} --output z3-mac-arm.zip
- name: Unzip Z3 and copy Z3
run: |
unzip z3-win.zip -d z3-win
unzip z3-linux.zip -d z3-linux
unzip z3-mac.zip -d z3-mac
unzip z3-mac-arm.zip -d z3-mac-arm
mkdir -p ViperToolsWin/z3/bin && cp $(find z3-win -name bin -type d)/z3.exe ViperToolsWin/z3/bin
mkdir -p ViperToolsLinux/z3/bin && cp $(find z3-linux -name bin -type d)/z3 ViperToolsLinux/z3/bin
mkdir -p ViperToolsMac/z3/bin && cp $(find z3-mac -name bin -type d)/z3 ViperToolsMac/z3/bin
mkdir -p ViperToolsMacARM/z3/bin && cp $(find z3-mac-arm -name bin -type d)/z3 ViperToolsMacARM/z3/bin
- name: Download Boogie
run: |
curl --fail --silent --show-error -L ${{ env.WIN_BOOGIE_URL }} --output boogie-win.zip
curl --fail --silent --show-error -L ${{ env.LINUX_BOOGIE_URL }} --output boogie-linux.zip
curl --fail --silent --show-error -L ${{ env.MAC_BOOGIE_URL }} --output boogie-mac.zip
curl --fail --silent --show-error -L ${{ env.MAC_ARM_BOOGIE_URL }} --output boogie-mac-arm.zip
- name: Unzip Boogie and copy Boogie
run: |
unzip boogie-win.zip -d boogie-win
unzip boogie-linux.zip -d boogie-linux
unzip boogie-mac.zip -d boogie-mac
unzip boogie-mac-arm.zip -d boogie-mac-arm
mkdir -p ViperToolsWin/boogie && cp -r boogie-win/binaries-win ViperToolsWin/boogie/Binaries
mkdir -p ViperToolsLinux/boogie && cp -r boogie-linux/binaries-linux ViperToolsLinux/boogie/Binaries
mkdir -p ViperToolsMac/boogie && cp -r boogie-mac/binaries-osx ViperToolsMac/boogie/Binaries
mkdir -p ViperToolsMacARM/boogie && cp -r boogie-mac-arm/binaries-osx-arm ViperToolsMacARM/boogie/Binaries
- name: Create folder to store all ViperTools platform zip files
run: mkdir deploy
# note that we change into the tool folder to zip it. This avoids including the parent folder in the zip
- name: Zip ViperTools for Windows
run: zip -r ../deploy/ViperToolsWin.zip ./*
working-directory: ViperToolsWin
- name: Zip ViperTools for Linux
run: zip -r ../deploy/ViperToolsLinux.zip ./*
working-directory: ViperToolsLinux
- name: Zip ViperTools for macOS Intel
run: zip -r ../deploy/ViperToolsMac.zip ./*
working-directory: ViperToolsMac
- name: Zip ViperTools for macOS ARM
run: zip -r ../deploy/ViperToolsMacARM.zip ./*
working-directory: ViperToolsMacARM
- name: Upload ViperTools zip files
uses: actions/upload-artifact@v4
with:
name: ViperTools
path: deploy
build-and-test:
name: build-and-test - ${{ matrix.os }}
needs: create-viper-tools
# make the dependency optional in the sense that this job should be executed whenever the dependency was successful or skipped:
if: ${{ always() && (contains(needs.create-viper-tools.result, 'success') || contains(needs.create-viper-tools.result, 'skipped')) }}
strategy:
# tests should not be stopped when they fail on one of the OSes:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
include:
- os: macos-latest
viper-tools-zip-file: "ViperToolsMac.zip"
- os: ubuntu-latest
viper-tools-zip-file: "ViperToolsLinux.zip"
- os: windows-latest
viper-tools-zip-file: "ViperToolsWin.zip"
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Viper-IDE
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: '18' # Should match the version in client/src/test/data/vscode-version
- name: Setup Java JDK
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'
- run: java --version
- name: Cache npm
uses: actions/cache@v4
with:
path: client/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
# npm ci fails to clone GitHub repos referenced in package.json with recent node versions
# the following work around has been proposed here: https://github.com/actions/setup-node/issues/214#issuecomment-810829250
- name: Reconfigure git to use HTTPS authentication
run: >
git config --global url."https://github.com/".insteadOf
ssh://git@github.com/
- run: npm ci --cache .npm --prefer-offline
working-directory: client
# there are two different scenarios in which different stuff should be tested:
# - regular changes to Viper-IDE: the normal test configuration should be used, which tests against the latest stable and
# nightly ViperTool releases. Any change to the Viper-IDE have ensure compatability
# - before releasing Viper-IDE together with some ViperTools, Viper-IDE has to be tested against the latest stable and
# nightly ViperTool releases AND the ViperTools that should be released.
- name: Download ViperTools to test against (only downloading previously created ViperTools)
if: ${{ contains(needs.create-viper-tools.result, 'success') }}
uses: actions/download-artifact@v4
with:
name: ViperTools
path: client/ViperTools
- name: Setup ViperTools folder
if: ${{ fromJSON(env.TEST_LOCAL_ON_PUSH_PR) && !contains(needs.create-viper-tools.result, 'success') }}
run: mkdir -p client/ViperTools
- name: Download ViperTools to test against (only downloading ViperTools for PUSH and PR operations if configured accordingly)
if: ${{ fromJSON(env.TEST_LOCAL_ON_PUSH_PR) && !contains(needs.create-viper-tools.result, 'success') }}
run: curl --fail --silent --show-error -L ${{ env.TEST_LOCAL_ON_PUSH_PR_VIPERTOOLS_URL }}/${{ matrix.viper-tools-zip-file }} --output ${{ matrix.viper-tools-zip-file }}
working-directory: client/ViperTools
- name: Unzip ViperTools (non-windows)
if: ${{ !startsWith(matrix.os, 'windows') && (fromJSON(env.TEST_LOCAL_ON_PUSH_PR) || contains(needs.create-viper-tools.result, 'success')) }}
run: unzip ${{ matrix.viper-tools-zip-file }} -d ExtractedTools
working-directory: client/ViperTools
- name: Unzip ViperTools (windows)
if: ${{ startsWith(matrix.os, 'windows') && (fromJSON(env.TEST_LOCAL_ON_PUSH_PR) || contains(needs.create-viper-tools.result, 'success')) }}
run: powershell Expand-Archive -LiteralPath ${{ matrix.viper-tools-zip-file }} -DestinationPath ExtractedTools
working-directory: client/ViperTools
- name: Download ViperServer JAR (only downloading ViperTools for PUSH and PR operations if configured accordingly)
if: ${{ fromJSON(env.TEST_LOCAL_ON_PUSH_PR) && !contains(needs.create-viper-tools.result, 'success') }}
run: curl --fail --silent --show-error -L ${{ env.TEST_LOCAL_ON_PUSH_PR_VIPERSERVER_URL }} --output viperserver.jar
working-directory: client/ViperTools/ExtractedTools/backends
- name: Create path to extracted tools (non-windows)
if: ${{ !startsWith(matrix.os, 'windows') && (fromJSON(env.TEST_LOCAL_ON_PUSH_PR) || contains(needs.create-viper-tools.result, 'success')) }}
run: |
echo "EXTRACTED_TOOLS_PATH=${{ github.workspace }}/client/ViperTools/ExtractedTools" >> $GITHUB_ENV
shell: bash
- name: Create path to extracted tools (windows)
if: ${{ startsWith(matrix.os, 'windows') && (fromJSON(env.TEST_LOCAL_ON_PUSH_PR) || contains(needs.create-viper-tools.result, 'success')) }}
# replace all backslashes by double backslashes to properly escape them in the resulting JSON
run: |
PATH='EXTRACTED_TOOLS_PATH=${{ github.workspace }}\client\ViperTools\ExtractedTools'
echo ${PATH//'\'/'\\'} >> $GITHUB_ENV
shell: bash
- name: Create an additional test config
if: ${{ fromJSON(env.TEST_LOCAL_ON_PUSH_PR) || contains(needs.create-viper-tools.result, 'success') }}
run: |
mkdir -p client/src/test/data/settings
echo '{
"viperSettings.buildVersion": "Local",
"viperSettings.paths": {
"v": "674a514867b1",
"viperToolsPath": {
"windows": "${{ env.EXTRACTED_TOOLS_PATH }}",
"linux": "${{ env.EXTRACTED_TOOLS_PATH }}",
"mac": "${{ env.EXTRACTED_TOOLS_PATH }}"
}
},
"viperserver.trace.server": "verbose"
}' > client/src/test/data/settings/ci_local.json
shell: bash
- name: Get config content
if: ${{ fromJSON(env.TEST_LOCAL_ON_PUSH_PR) || contains(needs.create-viper-tools.result, 'success') }}
run: cat client/src/test/data/settings/ci_local.json
shell: bash
- name: Run tests (headless - non-ubuntu)
if: "!startsWith(matrix.os, 'ubuntu')"
run: npm test --full-trace
working-directory: client
env:
VIPER_IDE_LOG_DIR: ${{ github.workspace }}/client/logs
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run tests (headless - ubuntu only)
if: startsWith(matrix.os, 'ubuntu')
run: xvfb-run -a npm test --full-trace
working-directory: client
env:
VIPER_IDE_LOG_DIR: ${{ github.workspace }}/client/logs
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Viper-IDE log files
if: ${{ failure() || cancelled() }}
uses: actions/upload-artifact@v4
with:
name: TestLogs-${{ matrix.os }}
path: client/logs
- name: Clean 'dist' folder (ubuntu only)
if: startsWith(matrix.os, 'ubuntu')
run: npm run clean
working-directory: client
# `npm run package` resp. `@vscode/vsce` complains that it cannot find
# locate-java-home and vs-verification-toolbox dependencies (the two non-npm dependencies).
# this seems related to https://github.com/npm/cli/issues/791
# the current workaround is to `run npm install` first:
# this workaround is only necessary when using node 14
# - name: Run 'npm install' as a workaround to later being able to package Viper-IDE (ubuntu only)
# if: startsWith(matrix.os, 'ubuntu')
# run: npm install
# working-directory: client
- name: List all files that will be packaged (ubuntu only)
if: startsWith(matrix.os, 'ubuntu')
run: npx @vscode/vsce ls
working-directory: client
# use @vscode/vsce to package the extension into a vsix file.
# sets a special field in package.json to indicate that the package is not a pre-release (it's one
# by default)
- name: Package Viper-IDE extension (ubuntu & stable release only)
if: ${{ startsWith(matrix.os, 'ubuntu') && github.event.inputs.type == 'stable' }}
run: |
npm pkg set viper.prerelease=false --json
npm run package -- --out viper-ide.vsix
working-directory: client
- name: Package Viper-IDE extension (ubuntu & non-stable release only)
if: ${{ startsWith(matrix.os, 'ubuntu') && github.event.inputs.type != 'stable' }}
run: npm run package -- --out viper-ide.vsix --pre-release
working-directory: client
- name: Upload packaged Viper-IDE (ubuntu-only)
if: startsWith(matrix.os, 'ubuntu')
uses: actions/upload-artifact@v4
with:
name: viper-ide.vsix
path: client/viper-ide.vsix
create-release:
# this job creates a nightly release or stable draft-release and adds viper-ide.vsix and Viper Tools as release assets
if: github.event_name == 'workflow_dispatch'
needs: build-and-test
runs-on: ubuntu-latest
env:
VIPERSERVER_RELEASE_URL: "https://github.com/viperproject/viperserver/releases/${{ github.event.inputs.viperserver_tag_name }}"
Z3_RELEASE_URL: "https://github.com/Z3Prover/z3/releases/z3-${{ github.event.inputs.z3_version }}"
BOOGIE_RELEASE_URL: ${{ github.event.inputs.boogie_tag_name == 'latest' && 'https://github.com/viperproject/boogie-builder/releases' || format('https://github.com/viperproject/boogie-builder/releases/{0}', github.event.inputs.boogie_tag_name) }}
steps:
# we have to checkout the repo to read client/package.json later on:
- name: Checkout Viper-IDE
uses: actions/checkout@v4
- name: Download packaged Viper IDE
uses: actions/download-artifact@v4
with:
name: viper-ide.vsix
path: client
- name: Download ViperTools
uses: actions/download-artifact@v4
with:
name: ViperTools
path: deploy
- name: Create release tag
if: ${{ github.event.inputs.type != 'stable' && github.event.inputs.type != 'rc' }}
shell: bash
run: echo "TAG_NAME=$(date +v-%Y-%m-%d-%H%M)" >> $GITHUB_ENV
# use the following action if nightly releases should eventually be deleted
# - name: Create nightly release
# if: ${{ github.event.inputs.type != 'stable' && github.event.inputs.type != 'rc' }}
# id: create_nightly_release
# uses: viperproject/create-nightly-release@v1
# env:
# # This token is provided by Actions, you do not need to create your own token
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# tag_name: ${{ env.TAG_NAME }}
# release_name: Nightly Release ${{ env.TAG_NAME }}
# body: Based on ViperServer release ${{ github.event.inputs.viperserver_tag_name }}
# keep_num: 1 # keep the previous nightly release such that there are always two
# because e.g. prusti-dev depends on the nightly releases and updates only twice a month to the
# latest version, nightly releases should be kept
- name: Create nightly release
if: ${{ github.event.inputs.type != 'stable' && github.event.inputs.type != 'rc' }}
id: create_nightly_release
uses: actions/create-release@v1
env:
# This token is provided by Actions, you do not need to create your own token
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.TAG_NAME }}
release_name: Nightly Release ${{ env.TAG_NAME }}
body: |
Based on
- ViperServer release [`${{ github.event.inputs.viperserver_tag_name }}`](${{ env.VIPERSERVER_RELEASE_URL }})
- [Z3 `${{ github.event.inputs.z3_version }}`](${{ env.Z3_RELEASE_URL }})
- [Boogie release `${{ github.event.inputs.boogie_tag_name }}`](${{ env.BOOGIE_RELEASE_URL }})
draft: false
prerelease: true
- name: Store nightly release upload URL
if: ${{ github.event.inputs.type != 'stable' && github.event.inputs.type != 'rc' }}
shell: bash
run: echo "UPLOAD_URL=${{ steps.create_nightly_release.outputs.upload_url }}" >> $GITHUB_ENV
- name: Create stable draft-release
if: ${{ github.event.inputs.type == 'stable' || github.event.inputs.type == 'rc' }}
id: create_stable_release
uses: actions/create-release@v1
env:
# This token is provided by Actions, you do not need to create your own token
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.event.inputs.tag_name }}
release_name: ${{ github.event.inputs.release_name }}
body: |
Based on
- ViperServer release [`${{ github.event.inputs.viperserver_tag_name }}`](${{ env.VIPERSERVER_RELEASE_URL }})
- [Z3 `${{ github.event.inputs.z3_version }}`](${{ env.Z3_RELEASE_URL }})
- [Boogie release `${{ github.event.inputs.boogie_tag_name }}`](${{ env.BOOGIE_RELEASE_URL }})
draft: true
prerelease: false
- name: Store stable release upload URL
if: ${{ github.event.inputs.type == 'stable' || github.event.inputs.type == 'rc' }}
shell: bash
run: echo "UPLOAD_URL=${{ steps.create_stable_release.outputs.upload_url }}" >> $GITHUB_ENV
- name: Upload packaged Viper IDE
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ env.UPLOAD_URL }}
asset_path: client/viper-ide.vsix
asset_name: viper-ide.vsix
asset_content_type: application/octet-stream
- name: Upload ViperTools for Windows
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ env.UPLOAD_URL }}
asset_path: deploy/ViperToolsWin.zip
asset_name: ViperToolsWin.zip
asset_content_type: application/zip
- name: Upload ViperTools for Ubuntu
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ env.UPLOAD_URL }}
asset_path: deploy/ViperToolsLinux.zip
asset_name: ViperToolsLinux.zip
asset_content_type: application/zip
- name: Upload ViperTools for macOS Intel
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ env.UPLOAD_URL }}
asset_path: deploy/ViperToolsMac.zip
asset_name: ViperToolsMac.zip
asset_content_type: application/zip
- name: Upload ViperTools for macOS ARM
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ env.UPLOAD_URL }}
asset_path: deploy/ViperToolsMacARM.zip
asset_name: ViperToolsMacARM.zip
asset_content_type: application/zip
# compare version in client/package.json with last published version on
# VS Marketplace and deploy this version if newer.
# credits go to @fpoli!
- name: Obtain version information
run: |
VSCE_OUTPUT="$(
npx @vscode/vsce show viper-admin.viper --json
)"
if [[ $(echo $VSCE_OUTPUT | grep --fixed-strings --line-regexp undefined) ]]; then
LAST_PUBLISHED_VERSION="0"
else
LAST_PUBLISHED_VERSION="$(
echo $VSCE_OUTPUT | jq '.versions[0].version' --raw-output
)"
fi
CURRENT_VERSION="$(
cat client/package.json | jq '.version' --raw-output
)"
echo "LAST_PUBLISHED_VERSION=$LAST_PUBLISHED_VERSION" >> $GITHUB_ENV
echo "CURRENT_VERSION=$CURRENT_VERSION" >> $GITHUB_ENV
# publish 'stable' releases (release-candidates will be released as pre-releases below)
- name: Publish the extension to Visual Studio Marketplace
uses: HaaLeo/publish-vscode-extension@v1
if: ${{ github.event.inputs.type == 'stable' && env.CURRENT_VERSION != env.LAST_PUBLISHED_VERSION }}
with:
pat: ${{ secrets.VSCE_TOKEN }}
registryUrl: https://marketplace.visualstudio.com
extensionFile: client/viper-ide.vsix
packagePath: ''
- name: Publish the extension to Open VSX Registry
uses: HaaLeo/publish-vscode-extension@v1
if: ${{ github.event.inputs.type == 'stable' && env.CURRENT_VERSION != env.LAST_PUBLISHED_VERSION }}
with:
pat: ${{ secrets.OPEN_VSX_TOKEN }}
registryUrl: https://open-vsx.org
extensionFile: client/viper-ide.vsix
packagePath: ''
# publish 'rc' releases as pre-releases
- name: Publish the extension to Visual Studio Marketplace (as pre-release)
uses: HaaLeo/publish-vscode-extension@v1
if: ${{ github.event.inputs.type == 'rc' && env.CURRENT_VERSION != env.LAST_PUBLISHED_VERSION }}
with:
pat: ${{ secrets.VSCE_TOKEN }}
registryUrl: https://marketplace.visualstudio.com
extensionFile: client/viper-ide.vsix
packagePath: ''
preRelease: true