Skip to content

Publish Current Release #13

Publish Current Release

Publish Current Release #13

name: Publish Current Release
on:
workflow_dispatch:
jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: windows-latest
arch: x86
platform: Windows
- os: windows-latest
arch: x64
platform: Windows
- os: windows-latest
arch: arm64
platform: Windows
- os: ubuntu-20.04
arch: x86
platform: Linux
- os: ubuntu-20.04
arch: x64
platform: Linux
- os: ubuntu-latest
arch: x86
platform: Linux
- os: ubuntu-latest
arch: x64
platform: Linux
- os: ubuntu-latest
arch: arm64
platform: Linux
- os: macos-latest
arch: x64
platform: MacOS
- os: macos-latest
arch: arm64
platform: MacOS
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: "9.0.x"
- name: Restore Dependencies
run: dotnet restore src/Pulse/Pulse.csproj
- name: Publish
run: dotnet publish src/Pulse/Pulse.csproj -c Release -o publish
env:
DOTNET_ROOT: ${{ env.DOTNET_ROOT }}
- name: Determine Executable Name
id: exe_name
run: |
if [[ "${{ matrix.os }}" == "windows-latest" ]]; then
echo "exe=Pulse.exe" >> $GITHUB_ENV
else
echo "exe=Pulse" >> $GITHUB_ENV
fi
shell: bash
# Packaging for Windows
- name: Package Executable (Windows)
if: matrix.os == 'windows-latest'
run: |
$zipName = "pulse-${{ matrix.os }}-${{ matrix.arch }}.zip"
Compress-Archive -Path publish\Pulse.exe -DestinationPath $zipName
Add-Content -Path $env:GITHUB_ENV -Value "ZIP_NAME=$zipName"
shell: pwsh
# Packaging for Linux and MacOS
- name: Package Executable (Unix)
if: matrix.os != 'windows-latest'
run: |
cd publish
zipName="pulse-${{ matrix.os }}-${{ matrix.arch }}.zip"
zip -r ../$zipName Pulse
echo "ZIP_NAME=$zipName" >> $GITHUB_ENV
shell: bash
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.ZIP_NAME }}
path: ${{ env.ZIP_NAME }}
release:
name: Create GitHub Release
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Extract Version from Pulse.csproj
id: get_version
run: |
version=$(grep -oPm1 "(?<=<Version>)[^<]+" src/Pulse/Pulse.csproj)
echo "version=$version" >> $GITHUB_OUTPUT
shell: bash
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: artifacts/
- name: List Artifacts for Debugging
run: find artifacts/ -type f
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.get_version.outputs.version }}
name: Release ${{ steps.get_version.outputs.version }}
body_path: ./Changelog.md
files: artifacts/**/*.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}