Fix releasing Dev17 #65
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: | |
| pull_request: | |
| types: [opened, reopened, ready_for_review, synchronize] | |
| push: | |
| branches: [master] | |
| tags-ignore: ["**"] | |
| jobs: | |
| version: | |
| name: Version | |
| concurrency: tagging | |
| if: ${{ github.ref == 'refs/heads/master' }} | |
| runs-on: ubuntu-latest | |
| outputs: | |
| semver: ${{ steps.format.outputs.semver }} # Without v prefix | |
| semver_tag: ${{ steps.semver-tag.outputs.semver_tag }} | |
| steps: | |
| - | |
| name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - | |
| name: Calculate semver tag | |
| id: semver-tag | |
| uses: gandarez/semver-action@master | |
| with: | |
| branching_model: trunk-based | |
| prefix: "" | |
| debug: true | |
| - | |
| name: Remove v prefix | |
| id: format | |
| run: | | |
| echo "${{ steps.semver-tag.outputs.semver_tag }}" | |
| ver=`echo "${{ steps.semver-tag.outputs.semver_tag }}" | sed 's/^v//'` | |
| echo "$ver" | |
| echo "semver=$ver" >> $GITHUB_OUTPUT | |
| - name: Create tag | |
| uses: actions/github-script@v7 | |
| with: | |
| github-token: ${{ github.token }} | |
| script: | | |
| github.rest.git.createRef({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| ref: "refs/tags/${{ steps.format.outputs.semver }}", | |
| sha: context.sha | |
| }) | |
| build-dev16: | |
| name: Build Dev16 | |
| runs-on: windows-latest | |
| needs: [version] | |
| steps: | |
| - | |
| name: Checkout | |
| uses: actions/checkout@v4 | |
| - | |
| name: Setup MSBuild | |
| uses: microsoft/setup-msbuild@v1 | |
| - | |
| name: Setup NuGet | |
| uses: NuGet/setup-nuget@v1 | |
| - | |
| name: Restore NuGet packages | |
| run: nuget restore ./Dev16/Dev16.csproj -PackagesDirectory ./packages -NonInteractive | |
| - | |
| name: Update version | |
| run: | | |
| (Get-Content -Path Dev16\source.extension.vsixmanifest) | | |
| ForEach-Object {$_ -Replace '1.0.0', '${{ needs.version.outputs.semver }}'} | | |
| Set-Content -Path Dev16\source.extension.vsixmanifest | |
| (Get-Content -Path Dev16\Properties\AssemblyInfo.cs) | | |
| ForEach-Object {$_ -Replace '1.0.0', '${{ needs.version.outputs.semver }}'} | | |
| Set-Content -Path Dev16\Properties\AssemblyInfo.cs | |
| - | |
| name: Build Dev16 for Release | |
| run: msbuild Dev16/Dev16.csproj -property:Configuration=Release -property:platform="AnyCPU" -property:DeployExtension=false | |
| - | |
| name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: WakaTime.Dev16.vsix | |
| path: Dev16/bin/Release/WakaTime.Dev16.vsix | |
| - | |
| name: Remove tag if failure | |
| if: ${{ failure() }} | |
| uses: actions/github-script@v7 | |
| with: | |
| github-token: ${{ github.token }} | |
| script: | | |
| github.rest.git.deleteRef({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| ref: "tags/${{ needs.version.outputs.semver }}" | |
| }) | |
| build-dev17: | |
| name: Build Dev17 | |
| runs-on: windows-latest | |
| needs: [version] | |
| steps: | |
| - | |
| name: Checkout | |
| uses: actions/checkout@v4 | |
| - | |
| name: Setup MSBuild | |
| uses: microsoft/setup-msbuild@v1 | |
| - | |
| name: Setup NuGet | |
| uses: NuGet/setup-nuget@v1 | |
| - | |
| name: Restore NuGet packages | |
| run: nuget restore ./Dev17/Dev17.csproj -PackagesDirectory ./packages -NonInteractive | |
| - | |
| name: Update version | |
| run: | | |
| (Get-Content -Path Dev17\source.extension.vsixmanifest) | | |
| ForEach-Object {$_ -Replace '1.0.0', '${{ needs.version.outputs.semver }}'} | | |
| Set-Content -Path Dev17\source.extension.vsixmanifest | |
| (Get-Content -Path Dev17\Properties\AssemblyInfo.cs) | | |
| ForEach-Object {$_ -Replace '1.0.0', '${{ needs.version.outputs.semver }}'} | | |
| Set-Content -Path Dev17\Properties\AssemblyInfo.cs | |
| - | |
| name: Build Dev17 for Release | |
| run: msbuild Dev17/Dev17.csproj -property:Configuration=Release -property:platform="x64" -property:DeployExtension=false | |
| - | |
| name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: WakaTime.Dev17.vsix | |
| path: Dev17/bin/x64/Release/WakaTime.Dev17.vsix | |
| - | |
| name: Remove tag if failure | |
| if: ${{ failure() }} | |
| uses: actions/github-script@v7 | |
| with: | |
| github-token: ${{ github.token }} | |
| script: | | |
| github.rest.git.deleteRef({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| ref: "tags/${{ needs.version.outputs.semver }}" | |
| }) | |
| publish-dev16: | |
| name: Publish Dev16 | |
| runs-on: windows-latest | |
| needs: [build-dev16, build-dev17] # set dependencies for all build steps to ensure all ran correctly and didn't delete the tag in case of failure | |
| steps: | |
| - | |
| name: Checkout | |
| uses: actions/checkout@v4 | |
| - | |
| name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: "*.Dev16.vsix" | |
| path: build/ | |
| - | |
| name: Print VSIX identity | |
| shell: pwsh | |
| run: | | |
| $vsix = Join-Path $env:GITHUB_WORKSPACE 'build\WakaTime.Dev16.vsix\WakaTime.Dev16.vsix' | |
| Write-Host "VSIX path: $vsix" | |
| if (-not (Test-Path $vsix)) { | |
| Write-Error "VSIX not found at $vsix" | |
| } | |
| $tmp = Join-Path $env:RUNNER_TEMP ("vsix_" + [guid]::NewGuid().ToString("N")) | |
| New-Item -ItemType Directory -Path $tmp | Out-Null | |
| Add-Type -AssemblyName System.IO.Compression.FileSystem | |
| [System.IO.Compression.ZipFile]::ExtractToDirectory($vsix, $tmp) | |
| $manifest = Get-ChildItem -Path $tmp -Recurse -File | | |
| Where-Object { $_.Name -in @('extension.vsixmanifest','source.extension.vsixmanifest') } | | |
| Select-Object -First 1 | |
| if (-not $manifest) { | |
| Write-Error "Could not find extension.vsixmanifest/source.extension.vsixmanifest inside the VSIX." | |
| } | |
| [xml]$xml = Get-Content $manifest.FullName | |
| # VSIX manifests can be slightly different shapes; handle both common ones | |
| $identity = $xml.PackageManifest.Metadata.Identity | |
| if (-not $identity) { $identity = $xml.PackageManifest.Metadata[0].Identity } | |
| Write-Host "Manifest file: $($manifest.FullName)" | |
| Write-Host "VSIX Id (Identity/@Id): $($identity.Id)" | |
| Write-Host "Publisher (Identity/@Publisher): $($identity.Publisher)" | |
| Write-Host "Version (Identity/@Version): $($identity.Version)" | |
| $displayName = $xml.PackageManifest.Metadata.DisplayName | |
| if ($displayName) { Write-Host "DisplayName: $displayName" } | |
| $internalName = $xml.PackageManifest.Metadata.InternalName | |
| if ($internalName) { Write-Host "InternalName: $internalName" } | |
| - | |
| name: Print publishManifest.json identity | |
| shell: pwsh | |
| run: | | |
| $pm = Join-Path $env:GITHUB_WORKSPACE 'Dev16\publishManifest.json' | |
| $json = Get-Content $pm -Raw | ConvertFrom-Json | |
| Write-Host "publishManifest.json: $pm" | |
| Write-Host "Publisher: $($json.publisher)" | |
| if ($json.identity) { | |
| Write-Host "Identity.InternalName: $($json.identity.internalName)" | |
| } | |
| - | |
| name: Publish Dev16 to Marketplace | |
| uses: cezarypiatek/VsixPublisherAction@1.1 | |
| with: | |
| extension-file: ${{ github.workspace }}\build\WakaTime.Dev16.vsix\WakaTime.Dev16.vsix | |
| publish-manifest-file: Dev16\publishManifest.json | |
| personal-access-code: ${{ secrets.VS_PUBLISHER_ACCESS_TOKEN }} | |
| publish-dev17: | |
| name: Publish Dev17 | |
| runs-on: windows-latest | |
| needs: [build-dev16, build-dev17] # set dependencies for all build steps to ensure all ran correctly and didn't delete the tag in case of failure | |
| steps: | |
| - | |
| name: Checkout | |
| uses: actions/checkout@v4 | |
| - | |
| name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: "*.Dev17.vsix" | |
| path: build/ | |
| - | |
| name: Print VSIX identity | |
| shell: pwsh | |
| run: | | |
| $vsix = Join-Path $env:GITHUB_WORKSPACE 'build\WakaTime.Dev17.vsix\WakaTime.Dev17.vsix' | |
| Write-Host "VSIX path: $vsix" | |
| if (-not (Test-Path $vsix)) { | |
| Write-Error "VSIX not found at $vsix" | |
| } | |
| $tmp = Join-Path $env:RUNNER_TEMP ("vsix_" + [guid]::NewGuid().ToString("N")) | |
| New-Item -ItemType Directory -Path $tmp | Out-Null | |
| Add-Type -AssemblyName System.IO.Compression.FileSystem | |
| [System.IO.Compression.ZipFile]::ExtractToDirectory($vsix, $tmp) | |
| $manifest = Get-ChildItem -Path $tmp -Recurse -File | | |
| Where-Object { $_.Name -in @('extension.vsixmanifest','source.extension.vsixmanifest') } | | |
| Select-Object -First 1 | |
| if (-not $manifest) { | |
| Write-Error "Could not find extension.vsixmanifest/source.extension.vsixmanifest inside the VSIX." | |
| } | |
| [xml]$xml = Get-Content $manifest.FullName | |
| # VSIX manifests can be slightly different shapes; handle both common ones | |
| $identity = $xml.PackageManifest.Metadata.Identity | |
| if (-not $identity) { $identity = $xml.PackageManifest.Metadata[0].Identity } | |
| Write-Host "Manifest file: $($manifest.FullName)" | |
| Write-Host "VSIX Id (Identity/@Id): $($identity.Id)" | |
| Write-Host "Publisher (Identity/@Publisher): $($identity.Publisher)" | |
| Write-Host "Version (Identity/@Version): $($identity.Version)" | |
| $displayName = $xml.PackageManifest.Metadata.DisplayName | |
| if ($displayName) { Write-Host "DisplayName: $displayName" } | |
| $internalName = $xml.PackageManifest.Metadata.InternalName | |
| if ($internalName) { Write-Host "InternalName: $internalName" } | |
| - | |
| name: Print publishManifest.json identity | |
| shell: pwsh | |
| run: | | |
| $pm = Join-Path $env:GITHUB_WORKSPACE 'Dev17\publishManifest.json' | |
| $json = Get-Content $pm -Raw | ConvertFrom-Json | |
| Write-Host "publishManifest.json: $pm" | |
| Write-Host "Publisher: $($json.publisher)" | |
| if ($json.identity) { | |
| Write-Host "Identity.InternalName: $($json.identity.internalName)" | |
| } | |
| - | |
| name: Publish Dev17 to Marketplace | |
| uses: cezarypiatek/VsixPublisherAction@1.1 | |
| with: | |
| extension-file: ${{ github.workspace }}\build\WakaTime.Dev17.vsix\WakaTime.Dev17.vsix | |
| publish-manifest-file: Dev17\publishManifest.json | |
| personal-access-code: ${{ secrets.VS_PUBLISHER_ACCESS_TOKEN }} | |
| release: | |
| name: Release | |
| runs-on: ubuntu-latest | |
| needs: [version, publish-dev16, publish-dev17] | |
| steps: | |
| - | |
| name: Checkout | |
| uses: actions/checkout@v4 | |
| - | |
| name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: "*.vsix" | |
| path: build/ | |
| - | |
| name: "Create release" | |
| uses: softprops/action-gh-release@master | |
| with: | |
| name: ${{ needs.version.outputs.semver }} | |
| tag_name: ${{ needs.version.outputs.semver }} | |
| target_commitish: ${{ github.sha }} | |
| draft: false | |
| files: ./build/*.vsix | |
| env: | |
| GITHUB_TOKEN: ${{ github.token }} |