Build new version #15
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: Build new version | |
on: | |
pull_request: | |
types: | |
- closed | |
workflow_dispatch: | |
inputs: | |
draft_release: | |
type: boolean | |
description: 'Create draft release' | |
required: false | |
default: false | |
no_publish: | |
type: boolean | |
description: 'Don''t publish (no release)' | |
required: false | |
default: false | |
jobs: | |
build: | |
if: ((github.event.pull_request.merged == true) || (github.event_name == 'workflow_dispatch')) | |
runs-on: windows-latest | |
env: | |
DOTNET_NOLOGO: true | |
DOTNET_CLI_TELEMETRY_OPTOUT: true | |
PROJECT_NAME: AssM | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: recursive | |
show-progress: false | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: Get version | |
id: get_version | |
run: echo "version=$((Select-Xml -Path .\$( $env:PROJECT_NAME ).csproj -XPath '/Project/PropertyGroup/AssemblyVersion').Node.InnerXML)" >> $env:GITHUB_OUTPUT | |
shell: pwsh | |
- name: Build version (win64, no dotnet) | |
run: dotnet publish -r win-x64 -c Release /p:PublishSingleFile=true --self-contained false | |
- name: Create artifact (win64, no dotnet) | |
uses: thedoctor0/[email protected] | |
with: | |
type: 'zip' | |
filename: AssM_${{ steps.get_version.outputs.version }}-win-x64.zip | |
directory: bin/Release/net8.0/win-x64/publish/ | |
exclusions: '*.pdb Avalonia.Labs.Gif.xml' | |
- name: Move artifact | |
run: mv bin/Release/net8.0/win-x64/publish/AssM_${{ steps.get_version.outputs.version }}-win-x64.zip ./ | |
- name: Clean | |
run: dotnet clean | |
- name: Build version (win64, with dotnet) | |
run: dotnet publish -r win-x64 -c Release /p:PublishSingleFile=true --self-contained true | |
- name: Create artifact (win64, with dotnet) | |
uses: thedoctor0/[email protected] | |
with: | |
type: 'zip' | |
filename: AssM_${{ steps.get_version.outputs.version }}_with_dotnet-win-x64.zip | |
directory: bin/Release/net8.0/win-x64/publish/ | |
exclusions: '*.pdb Avalonia.Labs.Gif.xml' | |
- name: Move artifact | |
run: mv bin/Release/net8.0/win-x64/publish/AssM_${{ steps.get_version.outputs.version }}_with_dotnet-win-x64.zip ./ | |
- name: Clean | |
run: dotnet clean | |
- name: Build version (linux64, no dotnet) | |
run: dotnet publish -r linux-x64 -c Release /p:PublishSingleFile=true --self-contained false | |
- name: Create artifact (linux64, no dotnet) | |
uses: thedoctor0/[email protected] | |
with: | |
type: 'zip' | |
filename: AssM_${{ steps.get_version.outputs.version }}-linux-x64.zip | |
directory: bin/Release/net8.0/linux-x64/publish/ | |
exclusions: '*.pdb Avalonia.Labs.Gif.xml' | |
- name: Move artifact | |
run: mv bin/Release/net8.0/linux-x64/publish/AssM_${{ steps.get_version.outputs.version }}-linux-x64.zip ./ | |
- name: Clean | |
run: dotnet clean | |
- name: Build version (linux64, with dotnet) | |
run: dotnet publish -r linux-x64 -c Release /p:PublishSingleFile=true --self-contained true | |
- name: Create artifact (linux64, with dotnet) | |
uses: thedoctor0/[email protected] | |
with: | |
type: 'zip' | |
filename: AssM_${{ steps.get_version.outputs.version }}_with_dotnet-linux-x64.zip | |
directory: bin/Release/net8.0/linux-x64/publish/ | |
exclusions: '*.pdb Avalonia.Labs.Gif.xml' | |
- name: Move artifact | |
run: mv bin/Release/net8.0/linux-x64/publish/AssM_${{ steps.get_version.outputs.version }}_with_dotnet-linux-x64.zip ./ | |
- name: Clean | |
run: dotnet clean | |
- name: Create tag | |
run: | | |
git tag v${{ steps.get_version.outputs.version }} | |
git push --tags | |
- name: Create changelog text | |
id: changelog | |
uses: loopwerk/tag-changelog@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create Draft Release | |
id: create_draft_release | |
uses: ncipollo/release-action@v1 | |
if: ${{ github.event_name == 'workflow_dispatch' && inputs.draft_release && !inputs.no_publish }} | |
with: | |
artifacts: AssM_${{ steps.get_version.outputs.version }}-win-x64.zip,AssM_${{ steps.get_version.outputs.version }}_with_dotnet-win-x64.zip,AssM_${{ steps.get_version.outputs.version }}-linux-x64.zip,AssM_${{ steps.get_version.outputs.version }}_with_dotnet-linux-x64.zip | |
name: AssM Release v${{ steps.get_version.outputs.version }}-pre | |
tag: v${{ steps.get_version.outputs.version }}_pre | |
commit: master | |
prerelease: true | |
draft: true | |
body: | | |
${{ steps.changelog.outputs.changes }} | |
- name: Create Release | |
id: create_release | |
uses: ncipollo/release-action@v1 | |
if: ${{ !inputs.draft_release && !inputs.no_publish }} | |
with: | |
artifacts: AssM_${{ steps.get_version.outputs.version }}-win-x64.zip,AssM_${{ steps.get_version.outputs.version }}_with_dotnet-win-x64.zip,AssM_${{ steps.get_version.outputs.version }}-linux-x64.zip,AssM_${{ steps.get_version.outputs.version }}_with_dotnet-linux-x64.zip | |
name: AssM Release v${{ steps.get_version.outputs.version }} | |
tag: v${{ steps.get_version.outputs.version }} | |
commit: master | |
prerelease: false | |
draft: false | |
body: | | |
${{ steps.changelog.outputs.changes }} |