Use publish profile #3
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 with Tag Version | |
on: | |
push: | |
tags: | |
- 'v*.*.*' # Match version tags like v1.0.0 | |
jobs: | |
release: | |
runs-on: windows-latest # Use a Windows runner | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Extract version from tag | |
run: echo "VERSION=${GITHUB_REF_NAME#refs/tags/v}" >> $GITHUB_ENV | |
- name: Update version in .csproj | |
run: | | |
echo "Updating version in .csproj to ${VERSION}" | |
powershell -Command "(Get-Content CsvConverter/CsvConverter.csproj) -replace '<Version>.*</Version>', '<Version>${VERSION}</Version>' | Set-Content CsvConverter/CsvConverter.csproj" | |
- name: Set up .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: '8.0.x' | |
- name: Publish application using publish profile | |
run: dotnet publish CsvConverter/CsvConverter.csproj -c Release /p:PublishProfile=Properties\PublishProfiles\FolderProfile.pubxml | |
- name: Archive published binaries | |
run: | | |
mkdir -p release | |
powershell Compress-Archive -Path "bin\Publish\*" -DestinationPath "release\CsvConverter-${{ env.VERSION }}.zip" | |
- name: Create GitHub Release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref_name }} | |
release_name: ${{ github.ref_name }} | |
draft: false | |
prerelease: false | |
files: release\CsvConverter-${{ env.VERSION }}.zip |