Skip to content

Release

Release #148

Workflow file for this run

name: Release
on:
workflow_dispatch:
push:
branches:
- 'release'
env:
VERSION: '1.10.6'
NUGET_REPO_URL: 'https://api.nuget.org/v3/index.json'
jobs:
VSIX:
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
- name: Sets environment variables - branch-name
uses: christianhelle/branch-name@master
- name: Sets environment variables - Nerdbank.GitVersioning
uses: dotnet/nbgv@master
with:
setAllVars: true
- name: Update Version
run: |
((Get-Content -Path Core/ApiClientCodeGen.Core/ApiClientCodeGen.Core.csproj -Raw) -Replace ">1.0.0<", ">${{ env.VERSION }}<") | Set-Content -Path Core/ApiClientCodeGen.Core/ApiClientCodeGen.Core.csproj
((Get-Content -Path VSIX/ApiClientCodeGen.VSIX/source.extension.vsixmanifest -Raw) -Replace "1.0.0", "${{ env.VERSION }}") | Set-Content -Path VSIX/ApiClientCodeGen.VSIX/source.extension.vsixmanifest
((Get-Content -Path VSIX/ApiClientCodeGen.VSIX.Dev17/source.extension.vsixmanifest -Raw) -Replace "1.0.0", "${{ env.VERSION }}") | Set-Content -Path VSIX/ApiClientCodeGen.VSIX.Dev17/source.extension.vsixmanifest
working-directory: src
shell: pwsh
- name: Restore
run: dotnet restore VSIX.sln
working-directory: src
- name: Setup MSBuild.exe
uses: microsoft/setup-msbuild@v2
- name: Build
run: msbuild VSIX.sln /property:Configuration=Release /p:DeployExtension=false
working-directory: src
- name: Move build output
run: |
mv src/VSIX/ApiClientCodeGen.VSIX/bin/Release/ApiClientCodeGenerator.vsix ApiClientCodeGenerator-VS2019-${{ env.VERSION }}.vsix
mv src/VSIX/ApiClientCodeGen.VSIX.Dev17/bin/Release/ApiClientCodeGenerator.vsix ApiClientCodeGenerator-VS2022-${{ env.VERSION }}.vsix
- name: Publish artifacts
uses: actions/upload-artifact@v4
with:
name: Visual Studio Extension
path: |
*.vsix
docs/Marketplace*.md
- name: Publish VSIX Packages
continue-on-error: true
run: |
$VsixPublisher = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VSSDK\VisualStudioIntegration\Tools\Bin\VsixPublisher.exe"
& $VsixPublisher login -personalAccessToken ${{ secrets.MARKETPLACE_PAT }} -publisherName ChristianResmaHelle
& $VsixPublisher publish -payload ApiClientCodeGenerator-VS2019-${{ env.VERSION }}.vsix -publishManifest src/publish-manifest.json -ignoreWarnings 'VSIXValidatorWarning01,VSIXValidatorWarning02'
& $VsixPublisher publish -payload ApiClientCodeGenerator-VS2022-${{ env.VERSION }}.vsix -publishManifest src/publish-manifest-vs2022.json -ignoreWarnings 'VSIXValidatorWarning01,VSIXValidatorWarning02'
CLI:
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
- name: Sets environment variables - branch-name
uses: christianhelle/branch-name@master
- name: Sets environment variables - Nerdbank.GitVersioning
uses: dotnet/nbgv@master
with:
setAllVars: true
- name: Update Version
run: ((Get-Content -Path Core/ApiClientCodeGen.Core/ApiClientCodeGen.Core.csproj -Raw) -Replace ">1.0.0<", ">${{ env.VERSION }}<") | Set-Content -Path Core/ApiClientCodeGen.Core/ApiClientCodeGen.Core.csproj
working-directory: src
- name: Build
run: dotnet build -c Release /p:UseSourceLink=true src/Rapicgen.sln -p:PackageVersion="${{ env.VERSION }}"
- name: Package CLI Tool
run: dotnet pack --no-build -c Release /p:UseSourceLink=true src/CLI/ApiClientCodeGen.CLI/ApiClientCodeGen.CLI.csproj -p:PackageVersion="${{ env.VERSION }}"
- name: Push packages to NuGet
run: dotnet nuget push **/*.nupkg -k ${{ secrets.NUGET_KEY }} -s ${{ env.NUGET_REPO_URL }} --no-symbols true
continue-on-error: true
- name: Publish artifacts
uses: actions/upload-artifact@v4
with:
name: CLI Tool
path: |
**/*.nupkg
docs/CLI.md
VSMac:
runs-on: macos-12
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Update Extension Version Info
run: |
sed -i -e 's/1.0/${{ env.VERSION }}/g' ./AddinInfo.cs
cat ./AddinInfo.cs
working-directory: src/VSMac/ApiClientCodeGen.VSMac/Properties
- name: Setup .NET versions
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.x
- name: Build
run: make
working-directory: src
- name: Archive binaries
run: zip -r VSMac-Binaries.zip .
working-directory: src/VSMac/ApiClientCodeGen.VSMac/bin/Release/
- name: Rename build output
run: mv *.mpack ApiClientCodeGenerator-VSMac2022-${{ env.VERSION }}.mpack
working-directory: src
- name: Publish artifacts
uses: actions/upload-artifact@v4
with:
name: Visual Studio for Mac Extension
path: |
src/VSMac/ApiClientCodeGen.VSMac/bin/Release/VSMac-Binaries.zip
src/*.mpack
docs/VisualStudioForMac.md
Release:
needs: [
VSIX,
CLI,
VSMac
]
runs-on: ubuntu-latest
steps:
- 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/${{ env.VERSION }}",
sha: context.sha
})
- name: Create release
id: create-release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.VERSION }}
release_name: v${{ env.VERSION }}
draft: true
prerelease: false
- uses: actions/download-artifact@v4
with:
path: artifacts
- name: Upload VSIX asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_path: artifacts/Visual Studio Extension/ApiClientCodeGenerator-VS2019-${{ env.VERSION }}.vsix
asset_name: ApiClientCodeGenerator-VS2019-${{ env.VERSION }}.vsix
asset_content_type: application/zip
- name: Upload VSIX for VS2022 asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_path: artifacts/Visual Studio Extension/ApiClientCodeGenerator-VS2022-${{ env.VERSION }}.vsix
asset_name: ApiClientCodeGenerator-VS2022-${{ env.VERSION }}.vsix
asset_content_type: application/zip
- name: Upload VSMac asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_path: artifacts/Visual Studio for Mac Extension/src/ApiClientCodeGenerator-VSMac2022-${{ env.VERSION }}.mpack
asset_name: ApiClientCodeGenerator-VSMac2022-${{ env.VERSION }}.mpack
asset_content_type: application/zip
- uses: actions/checkout@v4
with:
repository: christianhelle/vsmac-extensions-repo
ref: 'main'
token: ${{ secrets.ACTIONS_GITHUB_TOKEN }}
- uses: actions/download-artifact@v4
with:
path: artifacts
- name: Move artifact to stable folder
run: |
mkdir -p stable
mv artifacts/Visual\ Studio\ for\ Mac\ Extension/src/ApiClientCodeGenerator-VSMac2022-${{ env.VERSION }}.mpack stable/ApiClientCodeGenerator.mpack
rm -rf artifacts
- name: Git Commit Build Artifacts
if: github.ref == 'refs/heads/master'
run: |
git config --global user.name "Continuous Integration"
git config --global user.email "username@users.noreply.github.com"
git add stable/ApiClientCodeGenerator.mpack
git commit -m "Update stable .mpack file to version ${{ env.VERSION }}"
git push