Beta #71
Workflow file for this run
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: Beta | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
beta: | |
runs-on: windows-latest | |
steps: | |
- name: Git - Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Version | |
id: version | |
run: | | |
# Get the current date | |
$DATE = Get-Date -Format "yyyy.Md" | |
# Get the current time in hours and minutes (24-hour format) | |
$TIME = Get-Date -Format "Hmm" | |
# 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/[email protected] | |
with: | |
file: "src/**/*.csproj" | |
version: ${{ steps.version.outputs.version }} | |
- name: Release - Delete previous assets | |
uses: andreaswilli/[email protected] | |
with: | |
github_token: ${{ github.token }} | |
tag: 'v${{ steps.version.outputs.version }}' | |
- name: Release - Notes | |
uses: release-drafter/release-drafter@v6 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
name: 'Sidekick v${{ steps.version.outputs.version }}' | |
tag: 'v${{ steps.version.outputs.version }}' | |
version: 'v${{ steps.version.outputs.version }}' | |
publish: false | |
prerelease: true | |
- 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@v1 | |
with: | |
dotnet-version: 8.x | |
- name: .NET - Tests | |
shell: pwsh | |
run: | | |
dotnet restore | |
dotnet build --no-restore | |
dotnet test --no-build --verbosity normal | |
- name: .NET - Publish | |
shell: pwsh | |
run: | | |
$version = "${{ steps.version.outputs.version }}" | |
Write-Output "Version: $version" | |
dotnet publish src/Sidekick.Protocol/Sidekick.Protocol.csproj -p:PublishProfile=Build | |
dotnet publish src/Sidekick.Wpf/Sidekick.Wpf.csproj -c Release --self-contained true -r win-x64 -o ./Publish | |
- name: Velopack | |
shell: pwsh | |
run: | | |
$version = "${{ steps.version.outputs.version }}" | |
Write-Output "Version: $version" | |
dotnet tool install -g vpk | |
vpk download github --repoUrl https://github.com/Sidekick-Poe/Sidekick --channel windows-beta | |
vpk pack --packId Sidekick --packVersion $version --packDir Publish --channel windows-beta | |
vpk upload github --repoUrl https://github.com/Sidekick-Poe/Sidekick --channel windows-beta --pre --merge --releaseName "Sidekick v$version" --tag v$version --token ${{ github.token }} | |
- name: ClickOnce - Git Key | |
uses: webfactory/[email protected] | |
with: | |
ssh-private-key: ${{ secrets.DEPLOY_BETA_KEY }} | |
- name: ClickOnce | |
shell: pwsh | |
run: | | |
$version = "${{ steps.version.outputs.version }}" | |
Write-Output "Version: $version" | |
git config --global url."https://user:${{ secrets.GITHUB_TOKEN }}@github".insteadOf https://github | |
git config --global user.name github-actions | |
git config --global user.email [email protected] | |
# Find MSBuild. | |
$msBuildPath = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" ` | |
-latest -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe ` | |
-prerelease | select-object -first 1 | |
Push-Location "src/Sidekick.Wpf" | |
& $msBuildPath src/Sidekick.Wpf/Sidekick.Wpf.csproj /target:Publish /property:PublishProfile=ClickOnceBeta /property:ApplicationVersion=$version | |
Pop-Location | |
$deployRepository = "[email protected]:Sidekick-Poe/Sidekick-Beta.git" | |
Write-Output "Deploy repository: $deployRepository" | |
# Clone `gh-pages` branch. | |
git clone $deployRepository -b gh-pages --single-branch "ClickOnce" | |
Write-Output "Removing previous files..." | |
if (Test-Path "Application Files") { | |
Remove-Item -Path "ClickOnce/Application Files" -Recurse | |
} | |
if (Test-Path "Sidekick.application") { | |
Remove-Item -Path "ClickOnce/Sidekick.application" | |
} | |
Write-Output "Copying new files..." | |
Copy-Item -Path "./src/Sidekick.Wpf/bin/publish/Application Files","./src/Sidekick.Wpf/bin/publish/Sidekick.application" -Destination ./ClickOnce -Recurse | |
# Stage and commit. | |
git add -A | |
git commit -m "Update to v$version" | |
# git push |