Skip to content

Publish

Publish #39

Workflow file for this run

name: Publish
on:
# push:
# tags:
# - "*"
# Allows to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
Release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: fregante/setup-git-user@v1
- uses: actions/setup-node@v1
with:
node-version: 18
- name: "Install dependencies"
run: |
npm install -g yarn
yarn install
- name: "Read Package.json"
id: read_packageJson
run: |
content=`cat ./package.json`
# the following lines are only required for multi line json
content="${content//'%'/'%25'}"
content="${content//$'\n'/'%0A'}"
content="${content//$'\r'/'%0D'}"
# end of optional handling for multi line json
echo "::set-output name=packageJson::$content"
- name: "Parse Package.json"
id: parse_packageJson
run: |
echo "::set-output name=name::${{ fromJson(steps.read_packageJson.outputs.packageJson).name }}"
echo "::set-output name=version::${{ fromJson(steps.read_packageJson.outputs.packageJson).version }}"
- name: "Set vsixPath"
id: set_vsixPath
run: echo "::set-output name=vsixPath::${{ steps.parse_packageJson.outputs.name }}-${{ steps.parse_packageJson.outputs.version }}.vsix"
- name: "Package"
run: |
yarn build:prod
yarn vsce package --out ${{ steps.set_vsixPath.outputs.vsixPath }}
- name: "Publish to VSCode Marketplace"
run: yarn vsce publish --pat "${{ secrets.VSCODE_MARKETPLACE_TOKEN }}" --packagePath "${{ steps.set_vsixPath.outputs.vsixPath }}"
- name: "Publish to Open-VSX"
run: yarn ovsx publish "${{ steps.set_vsixPath.outputs.vsixPath }}" --pat ${{ secrets.OPEN_VSX_TOKEN }}
- name: "Create Tag"
id: create_tag
run: |
git tag --annotate "v${{ steps.parse_packageJson.outputs.version }}" --message "${{ steps.parse_packageJson.outputs.name }}"
git push origin --tags
echo "::set-output name=tag::v${{ steps.parse_packageJson.outputs.version }}"
- name: "Create release"
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: ${{ steps.create_tag.outputs.tag }}
prerelease: false
files: "${{ steps.set_vsixPath.outputs.vsixPath }}"