Added proper reference via the job in needs so the output can be set … #7
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: Build and Release VSIX | |
on: | |
push: | |
branches: | |
- main | |
- master | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: windows-latest | |
outputs: | |
version: ${{ steps.validate.outputs.newVersion }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20' | |
- name: Install vsce | |
run: npm install -g @vscode/vsce | |
- name: Install dependencies | |
run: | | |
cd .\anko\ | |
npm install | |
- name: Determine Version Bump | |
id: version | |
run: | | |
$comment = "${{ github.event.head_commit.message }}" | |
if ($comment -match "#major") { | |
echo "bumpType=major" >> $ENV:GITHUB_OUTPUT | |
} elseif ($comment -match "#minor") { | |
echo "bumpType=minor" >> $ENV:GITHUB_OUTPUT | |
} else { | |
echo "bumpType=patch" >> $ENV:GITHUB_OUTPUT | |
} | |
- name: Execute Update Script | |
id: update | |
run: | | |
$DebugInfo = @() | |
$DebugInfo += "Executing update.ps1 with VersionType=${{ steps.version.outputs.bumpType }}" | |
$result = pwsh ./scripts/update.ps1 ${{ steps.version.outputs.bumpType }} | |
echo "version=$result" >> $ENV:GITHUB_OUTPUT | |
echo "$DebugInfo" >> $ENV:GITHUB_STEP_SUMMARY | |
shell: pwsh | |
- name: Validate Version Output | |
id: validate | |
run: | | |
$version = "${{ steps.update.outputs.version }}" | |
echo "Validating version: $version" >> $ENV:GITHUB_STEP_SUMMARY | |
if ($version -notmatch "^\d+\.\d+\.\d+$") { | |
Write-Error "Invalid version format: $version" | |
exit 1 | |
} | |
echo "newVersion=$version" >> $ENV:GITHUB_OUTPUT | |
- name: Build VSIX file | |
run: | | |
cd .\anko\ | |
vsce package --allow-missing-repository --out ..\dist\blazium-anko-extension-${{ steps.validate.outputs.newVersion }}.vsix | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: blazium-anko-extension-vsix | |
path: dist/blazium-anko-extension-${{ steps.validate.outputs.newVersion }}.vsix | |
release: | |
needs: build | |
runs-on: windows-latest | |
steps: | |
- name: Download artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: blazium-anko-extension-vsix | |
- name: Create GitHub Release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ needs.build.outputs.version }} | |
release_name: Blazium Anko Extension v${{ needs.build.outputs.version }} | |
draft: false | |
prerelease: false | |
files: dist/blazium-anko-extension-${{ needs.build.outputs.version }}.vsix |