Merge pull request #423 from alephium/link_to_vscode_multi_root #58
Workflow file for this run
This file contains hidden or 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
name: Release | |
on: | |
push: | |
tags: [ "v[0-9]+.[0-9]+.[0-9]+*" ] | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: 17 | |
cache: sbt | |
- uses: sbt/setup-sbt@v1 | |
- name: Get the version | |
id: get_version | |
run: | | |
version=$(echo ${GITHUB_REF/refs\/tags\//} | cut -c 2-) | |
echo "VERSION=$version" >> $GITHUB_ENV | |
if [[ "$version" == *"-rc"* ]]; then | |
echo "IS_RC=true" >> $GITHUB_ENV | |
# Remove the patch version and `-rc` suffix | |
base_version=$(echo $version | sed -E 's/([0-9]+\.[0-9]+)\.[0-9]+-rc[0-9]+/\1./') | |
current_date=$(date +"%Y%m%d%H") | |
pre_release_version="${base_version}$current_date" | |
echo "PRE_RELEASE_VERSION=$pre_release_version" >> $GITHUB_ENV | |
else | |
echo "IS_RC=false" >> $GITHUB_ENV | |
echo "PRE_RELEASE_VERSION=$version" >> $GITHUB_ENV | |
fi | |
shell: bash | |
- run: sbt "compile; lsp-server/assembly; universal:packageBin" | |
- name: Install jq | |
run: sudo apt-get install jq | |
- name: Update version in package.json | |
run: | | |
cd plugin-vscode | |
if [[ "${{ env.IS_RC }}" == "true" ]]; then | |
jq --arg version "${{ env.PRE_RELEASE_VERSION }}" '.version = $version' package.json > tmp_package.json && mv tmp_package.json package.json | |
else | |
jq --arg version "${{ env.VERSION }}" '.version = $version' package.json > tmp_package.json && mv tmp_package.json package.json | |
fi | |
- name: Package VSCode Extension | |
run: | | |
sbt copyJARToVSCode | |
cd plugin-vscode | |
npm install -g vsce | |
npm install | |
if [[ "${{ env.IS_RC }}" == "true" ]]; then | |
vsce package --pre-release | |
else | |
vsce package | |
fi | |
shell: bash | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: v${{ env.VERSION }} | |
release_name: v${{ env.VERSION }} | |
body: Some solid code | |
draft: false | |
prerelease: ${{ env.IS_RC }} | |
- name: Upload Release Asset (Jar) | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: lsp-server/target/scala-2.13/ralph-lsp.jar | |
asset_name: ralph-lsp-${{ env.VERSION }}.jar | |
asset_content_type: application/java-archive | |
- name: Upload Release Asset (Universal zip) | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: target/universal/ralph-lsp-0.1.0-SNAPSHOT.zip | |
asset_name: ralph-lsp-${{ env.VERSION }}.zip | |
asset_content_type: application/zip | |
- name: Upload Release Asset (VSCode Extension) | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: plugin-vscode/ralph-lsp-${{ env.PRE_RELEASE_VERSION }}.vsix | |
asset_name: ralph-lsp-${{ env.PRE_RELEASE_VERSION }}.vsix | |
asset_content_type: application/octet-stream | |
- name: Publish VSCode Extension | |
env: | |
VSCE_PAT: ${{ secrets.VSCODE_PUBLISH_TOKEN }} | |
run: | | |
cd plugin-vscode | |
if [[ "${{ env.IS_RC }}" == "true" ]]; then | |
vsce publish --pre-release | |
else | |
vsce publish | |
fi | |
shell: bash |