Merge pull request #547 from clevebitr/master #132
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: CI-Installer | |
on: | |
push: | |
branches: | |
- master | |
- release/* | |
tags: | |
- installer-* | |
pull_request: | |
branches: | |
- master | |
- release/* | |
workflow_dispatch: | |
inputs: | |
configuration: | |
description: 'Configuration' | |
required: true | |
default: 'Release' | |
type: choice | |
options: | |
- Release | |
- Debug | |
env: | |
CONFIGURATION: ${{ inputs.configuration != '' && inputs.configuration || 'Release' }} | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 | |
DOTNET_NOLOGO: 1 | |
INSTALLER_DOTNET_VERSION: '8.0' | |
INSTALLER_PLATFORM: 'win-x64' | |
jobs: | |
windows: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '${{ env.INSTALLER_DOTNET_VERSION }}.x' | |
- name: "Set Publish Path" | |
run: echo "PUBLISH_PATH=./Installer/bin/${{ env.CONFIGURATION }}/net${{ env.INSTALLER_DOTNET_VERSION }}/${{ env.INSTALLER_PLATFORM }}/publish/" >> $GITHUB_ENV | |
shell: bash | |
- name: Build | |
run: dotnet build -c ${{ env.CONFIGURATION }} ./Installer/Installer.csproj | |
- name: Publish | |
run: dotnet publish -c ${{ env.CONFIGURATION }} ./Installer/Installer.csproj | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Installer.exe | |
path: ${{ env.PUBLISH_PATH }}Installer.exe | |
- name: Compute Release Info | |
if: startsWith(github.ref, 'refs/tags/') | |
run: | | |
export LC_NUMERIC="en_US.UTF-8" | |
file_name=${{ env.PUBLISH_PATH }}Installer.exe | |
file_size=`du --block-size="'1" --apparent-size "$file_name" | cut -f1` | |
file_size_mib=`du --block-size="'MiB" --apparent-size "$file_name" | cut -f1 | sed s/M/\ M/` | |
file_size_display="$file_size bytes ($file_size_mib)" | |
file_sha256=`sha256sum "$file_name" | cut -d" " -f1` | |
version=`echo ${{ github.head_ref || github.ref_name }} | cut -d- -f2` | |
release_name="Universal Installer $version" | |
echo "RELEASE_NAME=$release_name" >> $GITHUB_ENV | |
cp .github/RELEASE_TEMPLATE/content.md ./content.md | |
sed -i -e "s/FILE_SIZE_DISPLAY/$file_size_display/g" ./content.md | |
sed -i -e "s/FILE_SHA256/$file_sha256/g" ./content.md | |
shell: bash | |
- name: Zip | |
if: startsWith(github.ref, 'refs/tags/') | |
run: Compress-Archive -Path ${{ env.PUBLISH_PATH }}Installer.exe -Destination ./Installer.zip | |
shell: powershell | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
name: ${{ env.RELEASE_NAME }} | |
body_path: ./content.md | |
files: ./Installer.zip | |
make_latest: true |