fix: use github output and set id to use in other steps #14
Workflow file for this run
This file contains 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 | |
permissions: | |
contents: write | |
on: | |
push: | |
tags: | |
- '[0-9]+.[0-9]+.[0-9]+' # Minor version should be even for release and odd for pre-release | |
jobs: | |
create_release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Install dependencies | |
run: npm install | |
- name: Compile | |
run: npm run compile | |
- name: Resolve is pre-release | |
id: is_prerelease | |
run: echo "prerelease=$(node -p "'${{ github.ref }}'.split('.')[1] % 2 == 1")" >> $GITHUB_OUTPUT | |
- name: Publish Extension (Pre-Release) | |
if: steps.is_prerelease.outputs.prerelease == 'true' | |
run: npx @vscode/vsce publish --no-git-tag-version --pre-release ${{ github.ref }} | |
env: | |
VSCE_PAT: ${{ secrets.VSCE_PAT }} | |
- name: Publish Extension | |
if: steps.is_prerelease.outputs.prerelease == 'false' | |
run: npx @vscode/vsce publish --no-git-tag-version --pre-release ${{ github.ref }} | |
env: | |
VSCE_PAT: ${{ secrets.VSCE_PAT }} | |
- name: Create GitHub Release | |
if: steps.is_prerelease.outputs.prerelease == 'false' | |
id: create_release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: phpunit-*.vsix |