Skip to content

Build Release

Build Release #48

Workflow file for this run

name: Build Release
on:
workflow_dispatch:
jobs:
release:
strategy:
matrix:
os: [windows-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Git - Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Version
id: version
shell: pwsh
run: |
# Get the current date
$DATE = Get-Date -Format "yyyy.Mdd"
# Get the current hour and minute without leading zero for the hour
$HOUR = [int](Get-Date -Format "HH") # Convert hour to integer to strip any leading zero
# If the hour is 0 (midnight), set it to an empty string
if ($HOUR -eq 0) {
$HOUR = ''
}
$MINUTE = Get-Date -Format "mm" # Keep minutes as-is
# Construct the time, omitting hour if it's empty
$TIME = "$HOUR$MINUTE"
# Construct the version using DATE and TIME
$VERSION = "$DATE.$TIME"
Write-Output "Generated version: $VERSION"
# Export version as an output
echo "version=$VERSION" >> $env:GITHUB_OUTPUT
- name: Version - Update project files
uses: vers-one/dotnet-project-version-updater@v1.7
with:
file: "src/**/*.csproj"
version: ${{ steps.version.outputs.version }}
- name: Release - Delete unpublished
uses: hugo19941994/delete-draft-releases@v1.0.0
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Release - Notes
id: notes
uses: release-drafter/release-drafter@v6
env:
GITHUB_TOKEN: ${{ github.token }}
with:
config-name: release-drafter.yml
name: "Sidekick v${{ steps.version.outputs.version }}"
tag: "v${{ steps.version.outputs.version }}"
version: "v${{ steps.version.outputs.version }}"
publish: false
prerelease: false
- name: Environment - Build Number
uses: myci-actions/export-env-var@1
with:
name: BUILD_NUMBER
value: ${{ steps.version.outputs.version }}
- name: Environment - Github Token
uses: myci-actions/export-env-var@1
with:
name: GITHUB_TOKEN
value: ${{ github.token }}
- name: .NET - Setup
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x
- name: Windows - Test
if: matrix.os == 'windows-latest'
shell: pwsh
run: |
dotnet restore
dotnet build --no-restore
dotnet test --no-build --verbosity normal
- name: .NET - Publish (Windows)
if: matrix.os == 'windows-latest'
shell: pwsh
run: |
$version = "${{ steps.version.outputs.version }}"
Write-Output "Version: $version"
dotnet publish src/Sidekick.Wpf/Sidekick.Wpf.csproj -c Release -r win-x64 -o ./Publish
dotnet publish src/Sidekick.Web/Sidekick.Web.csproj -c Release -r win-x64 -o ./Publish-Web
- name: Velopack (Windows)
if: matrix.os == 'windows-latest'
shell: pwsh
run: |
$version = "${{ steps.version.outputs.version }}"
Write-Output "Version: $version"
$body = "${{ steps.notes.outputs.body }}"
Write-Output "Body: $body"
# Output the body to a .md file
$releaseNotesPath = "release-notes.md"
Set-Content -Path $releaseNotesPath -Value $body
Write-Output "Release notes saved to $releaseNotesPath"
dotnet tool install -g vpk
# Desktop version
vpk download github --repoUrl https://github.com/Sidekick-Poe/Sidekick --channel windows-stable
vpk pack --packId Sidekick --packVersion $version --packDir Publish --channel windows-stable --releaseNotes $releaseNotesPath --framework net8.0-x64-desktop,webview2
vpk upload github --repoUrl https://github.com/Sidekick-Poe/Sidekick --channel windows-stable --merge --releaseName "Sidekick v$version" --tag v$version --token ${{ github.token }}
# Web version
vpk download github --repoUrl https://github.com/Sidekick-Poe/Sidekick --channel windows-web-stable
vpk pack --packId Sidekick --packVersion $version --packDir Publish-Web --channel windows-web-stable --releaseNotes $releaseNotesPath --framework net8.0-x64-aspnetcore,net8.0-x64-runtime
vpk upload github --repoUrl https://github.com/Sidekick-Poe/Sidekick --channel windows-web-stable --merge --releaseName "Sidekick v$version" --tag v$version --token ${{ github.token }}
- name: .NET - Publish (Ubuntu)
if: matrix.os == 'ubuntu-latest'
shell: bash
run: |
version="${{ steps.version.outputs.version }}"
echo "Version: $version"
dotnet build src/Sidekick.PhotinoBlazor/Sidekick.PhotinoBlazor.csproj -c Release -r linux-x64
dotnet publish src/Sidekick.PhotinoBlazor/Sidekick.PhotinoBlazor.csproj -c Release -r linux-x64 -o ./Publish
dotnet publish src/Sidekick.Web/Sidekick.Web.csproj -c Release -r linux-x64 -o ./Publish-Web
- name: Velopack (Ubuntu)
if: matrix.os == 'ubuntu-latest'
shell: bash
run: |
version="${{ steps.version.outputs.version }}"
echo "Version: $version"
body="${{ steps.notes.outputs.body }}"
echo "Body: $body"
# Output the body to a .md file
releaseNotesPath="release-notes.md"
echo "$body" > "$releaseNotesPath"
echo "Release notes saved to $releaseNotesPath"
dotnet tool install -g vpk
export PATH="$PATH:$HOME/.dotnet/tools"
# Desktop version
vpk download github --repoUrl https://github.com/Sidekick-Poe/Sidekick --channel linux-stable
vpk pack --packId Sidekick --packVersion $version --packDir Publish --channel linux-stable --releaseNotes $releaseNotesPath
vpk upload github --repoUrl https://github.com/Sidekick-Poe/Sidekick --channel linux-stable --merge --releaseName "Sidekick v$version" --tag v$version --token ${{ github.token }}
# Web version
vpk download github --repoUrl https://github.com/Sidekick-Poe/Sidekick --channel linux-web-stable
vpk pack --packId Sidekick --packVersion $version --packDir Publish-Web --channel linux-web-stable --releaseNotes $releaseNotesPath
vpk upload github --repoUrl https://github.com/Sidekick-Poe/Sidekick --channel linux-web-stable --merge --releaseName "Sidekick v$version" --tag v$version --token ${{ github.token }}