-
Notifications
You must be signed in to change notification settings - Fork 31
180 lines (152 loc) · 7.63 KB
/
wpf-beta.yml
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
name: Sidekick WPF Beta
on:
push:
branches:
- main
workflow_dispatch:
jobs:
release:
runs-on: windows-latest
steps:
- name: Git - Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: GitVersion - Install
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '5.x'
- name: GitVersion - Execute
id: gitversion
uses: gittools/actions/gitversion/[email protected]
with:
useConfigFile: true
additionalArguments: '/updateprojectfiles'
- name: GitVersion - Output
run: |
echo "Major: ${{ steps.gitversion.outputs.major }}"
echo "Minor: ${{ steps.gitversion.outputs.minor }}"
echo "Patch: ${{ steps.gitversion.outputs.patch }}"
echo "PreReleaseTag: ${{ steps.gitversion.outputs.preReleaseTag }}"
echo "PreReleaseTagWithDash: ${{ steps.gitversion.outputs.preReleaseTagWithDash }}"
echo "PreReleaseLabel: ${{ steps.gitversion.outputs.preReleaseLabel }}"
echo "PreReleaseNumber: ${{ steps.gitversion.outputs.preReleaseNumber }}"
echo "WeightedPreReleaseNumber: ${{ steps.gitversion.outputs.weightedPreReleaseNumber }}"
echo "BuildMetaData: ${{ steps.gitversion.outputs.buildMetaData }}"
echo "BuildMetaDataPadded: ${{ steps.gitversion.outputs.buildMetaDataPadded }}"
echo "FullBuildMetaData: ${{ steps.gitversion.outputs.fullBuildMetaData }}"
echo "MajorMinorPatch: ${{ steps.gitversion.outputs.majorMinorPatch }}"
echo "SemVer: ${{ steps.gitversion.outputs.semVer }}"
echo "LegacySemVer: ${{ steps.gitversion.outputs.legacySemVer }}"
echo "LegacySemVerPadded: ${{ steps.gitversion.outputs.legacySemVerPadded }}"
echo "AssemblySemVer: ${{ steps.gitversion.outputs.assemblySemVer }}"
echo "AssemblySemFileVer: ${{ steps.gitversion.outputs.assemblySemFileVer }}"
echo "FullSemVer: ${{ steps.gitversion.outputs.fullSemVer }}"
echo "InformationalVersion: ${{ steps.gitversion.outputs.informationalVersion }}"
echo "BranchName: ${{ steps.gitversion.outputs.branchName }}"
echo "EscapedBranchName: ${{ steps.gitversion.outputs.escapedBranchName }}"
echo "Sha: ${{ steps.gitversion.outputs.sha }}"
echo "ShortSha: ${{ steps.gitversion.outputs.shortSha }}"
echo "NuGetVersionV2: ${{ steps.gitversion.outputs.nuGetVersionV2 }}"
echo "NuGetVersion: ${{ steps.gitversion.outputs.nuGetVersion }}"
echo "NuGetPreReleaseTagV2: ${{ steps.gitversion.outputs.nuGetPreReleaseTagV2 }}"
echo "NuGetPreReleaseTag: ${{ steps.gitversion.outputs.nuGetPreReleaseTag }}"
echo "VersionSourceSha: ${{ steps.gitversion.outputs.versionSourceSha }}"
echo "CommitsSinceVersionSource: ${{ steps.gitversion.outputs.commitsSinceVersionSource }}"
echo "CommitsSinceVersionSourcePadded: ${{ steps.gitversion.outputs.commitsSinceVersionSourcePadded }}"
echo "UncommittedChanges: ${{ steps.gitversion.outputs.uncommittedChanges }}"
echo "CommitDate: ${{ steps.gitversion.outputs.commitDate }}"
- name: Environment - Build Number
uses: myci-actions/export-env-var@1
with:
name: BUILD_NUMBER
value: ${{ steps.gitversion.outputs.fullSemVer }}
- name: Environment - Github Token
uses: myci-actions/export-env-var@1
with:
name: GITHUB_TOKEN
value: ${{ github.token }}
- name: .NET 7 - Setup
uses: actions/setup-dotnet@v1
with:
dotnet-version: 7.x
- name: .NET - Restore
run: dotnet restore
- name: .NET - Build
run: dotnet build --no-restore
- name: .NET - Tests
run: dotnet test --no-build --verbosity normal
- name: Setup Git
run: |
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]
- name: Run release script
shell: pwsh
run: |
$applicationName = "Sidekick"
Write-Output "Application name: $applicationName"
$projectDirectory = "src/Sidekick.Wpf"
Write-Output "Project directory: $projectDirectory"
$publishDirectory = "$projectDirectory/bin/publish"
Write-Output "Publish directory: $publishDirectory"
$version = "v${{ steps.gitversion.outputs.assemblySemFileVer }}"
Write-Output "Version: $version"
$deployRepository = "https://github.com/Sidekick-Poe/Sidekick-Release.git"
Write-Output "Deploy repository: $deployRepository"
Write-Output "Working directory: $pwd"
# 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
Write-Output "MSBuild path: $((Get-Command $msBuildPath).Path)"
Set-StrictMode -version 2.0
$ErrorActionPreference = "Stop"
# Publish the application.
Push-Location $projectDirectory
try {
Write-Output "Publishing:"
& $msBuildPath /target:publish /p:PublishProfile=ClickOnceProfile /p:ApplicationVersion=$version /p:Configuration=Release /p:PublishDir=bin/publish /p:PublishUrl=bin/publish
# Measure publish size.
$publishSize = (Get-ChildItem -Path "bin/publish/Application Files" -Recurse Measure-Object -Property Length -Sum).Sum / 1Mb
Write-Output ("Published size: {0:N2} MB" -f $publishSize)
}
finally {
Pop-Location
}
# Clone `gh-pages` branch.
git clone $deployRepository -b gh-pages --depth 1 --single-branch "dist"
Push-Location "dist"
try {
# Remove previous application files.
Write-Output "Removing previous files..."
if (Test-Path "Application Files") {
Remove-Item -Path "Application Files" -Recurse
}
if (Test-Path "$applicationName.application") {
Remove-Item -Path "$applicationName.application"
}
# Copy new application files.
Write-Output "Copying new files..."
Copy-Item -Path "../$publishDirectory/Application Files","../$publishDirectory/$applicationName.application" -Destination . -Recurse
# Stage and commit.
# Write-Output "Staging..."
# git add -A
# Write-Output "Committing..."
# git commit -m "Update to v$version"
# Write-Output "Pushing..."
# git push
} finally {
Pop-Location
}
- name: Pushes to release repository
uses: cpina/github-action-push-to-another-repository@main
env:
SSH_DEPLOY_KEY: ${{ secrets.DEPLOY_BETA_KEY }}
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }}
with:
source-directory: 'dist'
destination-github-username: 'Sidekkick-Poe'
destination-repository-name: 'Sidekick-Beta'
user-email: [email protected]
target-branch: gh-pages