-
Notifications
You must be signed in to change notification settings - Fork 52
85 lines (71 loc) · 2.98 KB
/
Copy pathrelease.yml
File metadata and controls
85 lines (71 loc) · 2.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
name: Release
on:
workflow_dispatch:
inputs:
version:
description: 'Release version (e.g. 3.0.1.0)'
required: true
type: string
prerelease:
description: 'Mark this release as a pre-release'
required: false
type: boolean
default: false
jobs:
release:
runs-on: windows-latest
env:
Solution_Path: KoenZomers.KeePass.OneDriveSync.sln
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: repo
- name: Checkout OneDrive API dependency
uses: actions/checkout@v4
with:
repository: KoenZomers/OneDriveAPI
path: OneDriveAPI
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2
- name: Setup NuGet
uses: NuGet/setup-nuget@v2
- name: Install KeePass
run: choco install keepass -y --no-progress
- name: Stage KeePass at expected relative reference path
run: |
$keePassExe = Get-ChildItem -Path 'C:\Program Files*','C:\ProgramData\chocolatey\lib' -Filter 'KeePass.exe' -Recurse -ErrorAction SilentlyContinue | Select-Object -First 1
if (-not $keePassExe) {
throw "KeePass.exe not found after installation"
}
# Matches the project's literal HintPath: ..\..\..\..\Program Files\KeePass Password Safe 2\KeePass.exe
$projectDir = Join-Path $env:GITHUB_WORKSPACE 'repo\KoenZomers.KeePass.OneDriveSync'
$targetDir = [System.IO.Path]::GetFullPath((Join-Path $projectDir '..\..\..\..\Program Files\KeePass Password Safe 2'))
New-Item -ItemType Directory -Force -Path $targetDir | Out-Null
Copy-Item -Path (Join-Path $keePassExe.DirectoryName '*') -Destination $targetDir -Recurse -Force
- name: Update version number
working-directory: repo
run: |
$version = "${{ inputs.version }}"
$assemblyVersion = $version
if (($version.Split('.')).Length -lt 4) {
$assemblyVersion = "$version.0"
}
$assemblyInfoPath = 'KoenZomers.KeePass.OneDriveSync\Properties\AssemblyInfo.cs'
(Get-Content $assemblyInfoPath) -replace 'AssemblyVersion\("[^"]+"\)', "AssemblyVersion(`"$assemblyVersion`")" | Set-Content $assemblyInfoPath
Set-Content -Path 'version.txt' -Value ":`nKoenZomers.KeePass.OneDriveSync:$assemblyVersion`n:"
- name: Build PLGX package
working-directory: repo
run: .\create-plgx.cmd
- name: Rename PLGX release asset
run: Copy-Item -Path repo\KeeOneDriveSync.plgx -Destination "KeeOneDriveSync-${{ inputs.version }}.plgx" -Force
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ inputs.version }}
name: Version ${{ inputs.version }}
prerelease: ${{ inputs.prerelease }}
generate_release_notes: true
files: KeeOneDriveSync-${{ inputs.version }}.plgx