Publish Release #6
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: Publish Release | |
on: | |
workflow_dispatch: | |
env: | |
PROJECT_PATH: dev/AlAnvar.csproj | |
DIR_PATH: publish | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up NuGet | |
run: | | |
nuget sources add -name Labs -source https://pkgs.dev.azure.com/dotnet/CommunityToolkit/_packaging/CommunityToolkit-Labs/nuget/v3/index.json | |
nuget sources add -name Main-Labs -source https://pkgs.dev.azure.com/dotnet/CommunityToolkit/_packaging/CommunityToolkit-MainLatest/nuget/v3/index.json | |
- name: Get Version | |
uses: kzrnm/get-net-sdk-project-versions-action@v1.3.0 | |
id: get-version | |
with: | |
proj-path: ${{ env.PROJECT_PATH }} | |
- name: Build and Publish | |
run: dotnet publish ${{ env.PROJECT_PATH }} -c Release -r win10-x64 -p:Platform=x64 --self-contained true -p:PublishSingleFile=false -p:PublishReadyToRun=true -p:PublishTrimmed=false --output publish | |
- name: Zip Publish Folder | |
uses: vimtor/action-zip@v1.1 | |
with: | |
files: ${{ env.DIR_PATH }} | |
recursive: true | |
dest: publish/App-v${{steps.get-version.outputs.version-prefix}}.zip | |
- name: Create Github Release | |
uses: actions/create-release@v1.1.4 | |
id: create_release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
VersionName: v${{steps.get-version.outputs.version-prefix}} | |
with: | |
tag_name: ${{ env.VersionName }} | |
release_name: ${{ env.VersionName }} | |
- name: Upload Zip file to Github Release | |
uses: csexton/release-asset-action@v2 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
file: publish/App-v${{steps.get-version.outputs.version-prefix}}.zip | |
release-url: ${{ steps.create_release.outputs.upload_url }} | |
changelog: | |
needs: build | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Get Version | |
uses: kzrnm/get-net-sdk-project-versions-action@v1.3.0 | |
id: get-version | |
with: | |
proj-path: ${{ env.PROJECT_PATH }} | |
- name: Install auto-changelog Package | |
run: npm install -g auto-changelog | |
- name: Generate CHANGELOG.md | |
run: auto-changelog --commit-limit false --starting-version v${{steps.get-version.outputs.version-prefix}} --ending-version v${{steps.get-version.outputs.version-prefix}} --hide-credit | |
- name: Get Latest Github Release | |
id: latest_release | |
uses: kaliber5/action-get-release@v1 | |
with: | |
token: ${{ github.token }} | |
latest: true | |
- name: Read CHANGELOG.md Content | |
id: changelog | |
uses: jaywcjlove/github-action-read-file@main | |
with: | |
localfile: CHANGELOG.md | |
- name: Update Github Release with CHANGELOG.md | |
uses: kaliber5/action-update-release@v1 | |
with: | |
token: ${{ github.token }} | |
id: ${{ steps.latest_release.outputs.id }} | |
body: ${{ steps.changelog.outputs.content }} |