Publish extension to VS Marketplace when there is a new tag release #4
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: Build conan-vs-extension | ||
on: | ||
push: | ||
branches: [ develop2 ] | ||
pull_request: | ||
branches: [ develop2 ] | ||
jobs: | ||
build: | ||
runs-on: windows-latest | ||
steps: | ||
- name: Checkout the repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 1 | ||
- name: Cache NuGet packages | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~\nuget\packages | ||
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.config') }} | ||
restore-keys: | | ||
${{ runner.os }}-nuget- | ||
- name: Setup NuGet | ||
uses: nuget/setup-nuget@v1 | ||
- name: Setup msbuild | ||
uses: microsoft/setup-msbuild@v2 | ||
- name: Restore NuGet | ||
run: nuget restore | ||
- name: Build conan-vs-extension | ||
run: msbuild /p:configuration=Release /p:Platform="Any CPU" /p:DeployExtension=false /p:ZipPackageCompressionLevel=normal | ||
- name: Upload VSIX as artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: conan-vs-extension.vsix | ||
path: bin\Release\conan-vs-extension.vsix | ||
if-no-files-found: error | ||
releaseDraft: | ||
name: Release draft | ||
if: github.event_name != 'pull_request' && github.ref_name == "develop2" | ||
Check failure on line 47 in .github/workflows/main.yml GitHub Actions / Build conan-vs-extensionInvalid workflow file
|
||
needs: [ build ] | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
steps: | ||
- name: Download extension artifact from latest workflow build | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: conan-vs-extension.vsix | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
run-id: ${{ needs.build.run_id }} | ||
- name: Remove old release drafts | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
gh api repos/{owner}/{repo}/releases \ | ||
--jq '.[] | select(.draft == true) | .id' \ | ||
| xargs -I '{}' gh api -X DELETE repos/{owner}/{repo}/releases/{} | ||
- name: Get release version | ||
id: version | ||
run: | | ||
VERSION=$(grep -oP '(?<=<Identity Id="[^"]+" Version=")[^"]+' source.extension.vsixmanifest | sed -n 1p) | ||
echo "version=$VERSION" >> $GITHUB_OUTPUT | ||
- name: Create new release draft | ||
uses: actions/create-release@v1 | ||
id: create_release | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
with: | ||
draft: true | ||
prerelease: false | ||
release_name: ${{ steps.version.outputs.version }} | ||
tag_name: v${{ steps.version.outputs.version }} | ||
- name: Upload extension artifact to new release draft | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: conan-vs-extension.vsix | ||
asset_name: conan-vs-extension.vsix |