Skip to content

Commit

Permalink
Merge pull request #88 from micahmo/feature/workflows
Browse files Browse the repository at this point in the history
Finish new workflows
  • Loading branch information
micahmo authored Feb 3, 2023
2 parents 9d13e38 + f449413 commit a339153
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/create_release_branch.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Create Release Branch
name: 1. Create Release Branch

on:
workflow_dispatch:
Expand Down
31 changes: 30 additions & 1 deletion .github/workflows/generate_release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,33 @@
name: Generate Release
name: 3. Generate Release

on:
workflow_dispatch:

jobs:
generate_release:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Determine Version Number
id: determine_version_number
run: echo "VERSION_NUMBER=$($env:GITHUB_REF_NAME.Replace('release/v', ''))" >> $env:GITHUB_OUTPUT
- name: Determine Version Notes
id: determine_release_notes
run: |
echo "VERSION_NOTES<<EOF" >> $env:GITHUB_OUTPUT
echo $((Get-Content -Raw WireGuardServerForWindows\VersionInfo2.xml | Select-String "(?s)<VersionNotes>(.*)<\/VersionNotes>").Matches.Groups[1].Value) >> $env:GITHUB_OUTPUT
echo "EOF" >> $env:GITHUB_OUTPUT
- name: Setup MSBuild
uses: microsoft/setup-msbuild@main
- name: Download .NET Core Runtime
run: Invoke-WebRequest https://download.visualstudio.microsoft.com/download/pr/3f56df9d-6dc0-4897-a49b-ea891f9ad0f4/076e353a29908c70e24ba8b8d0daefb8/windowsdesktop-runtime-3.1.21-win-x64.exe -OutFile Installer\windowsdesktop-runtime-3.1.21-win-x64.exe
- name: Generate Release
run: Installer\GenerateRelease.ps1
- name: Publish Release
uses: softprops/action-gh-release@master
with:
files: Installer/WS4WSetup-${{ steps.determine_version_number.outputs.VERSION_NUMBER }}.exe
fail_on_unmatched_files: true
tag_name: v${{ steps.determine_version_number.outputs.VERSION_NUMBER }}
body: ${{ steps.determine_release_notes.outputs.VERSION_NOTES }}
draft: true
26 changes: 25 additions & 1 deletion .github/workflows/update_versions.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,28 @@
name: Update Versions
name: 2. Update Versions

on:
workflow_dispatch:
inputs:
version_notes:
description: 'Version Notes (example, including quotes: " - First change`n - Second Change")'

jobs:
update_versions:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Determine Version Number
id: determine_version_number
run: echo "VERSION_NUMBER=$($env:GITHUB_REF_NAME.Replace('release/v', ''))" >> $env:GITHUB_OUTPUT
- name: Run UpdateVersions.ps1
run: Installer\UpdateVersions.ps1 ${{ steps.determine_version_number.outputs.VERSION_NUMBER }} ${{ github.event.inputs.version_notes }}
- name: Create Pull Request
uses: peter-evans/create-pull-request@main
with:
commit-message: Bump version to ${{ steps.determine_version_number.outputs.VERSION_NUMBER }}
title: Bump version to ${{ steps.determine_version_number.outputs.VERSION_NUMBER }}
body: >
Bump version to ${{ steps.determine_version_number.outputs.VERSION_NUMBER }}
branch: feature/update-versions-${{ steps.determine_version_number.outputs.VERSION_NUMBER }}
1 change: 1 addition & 0 deletions Installer/GenerateRelease.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ foreach ($configuration in "Debug", "Release") {
}
}

dotnet restore
msbuild WgServerforWindows.sln /property:Configuration=Release

Remove-Item Installer\WS4WSetup-*.exe
Expand Down
21 changes: 19 additions & 2 deletions Installer/UpdateVersions.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# This script is intended to be run from the root of the repo, like .\Installer\UpdateVersions.ps1

$newVersion = Read-Host "Enter the new version number (without 'v' and without trailing '.0')"
$newVersion = $args[0]
$versionNotes = $args[1]

if ($args.count -eq 0) {
$newVersion = Read-Host "Enter the new version number (without 'v' and without trailing '.0')"
}

# Directory.Build.props
$directoryBuildPropsFile = Get-Content "Directory.Build.props"
Expand Down Expand Up @@ -53,7 +58,19 @@ for ($i = 0; $i -lt $versionInfo.Length; $i += 1) {

if ($line -match "DownloadFileName") {
$versionInfo[$i] = " <DownloadFileName>WS4WSetup-$($newVersion).exe</DownloadFileName>"
}
}

if ($line -match "<VersionNotes") {
$startVersionNotesLines = $i
}

if ($line -match "</VersionNotes") {
for ($j = $startVersionNotesLines; $j -le $i; $j += 1) {
$versionInfo[$j] = $null
}

$versionInfo[$startVersionNotesLines] = " <VersionNotes>$($versionNotes)</VersionNotes>"
}
}

Set-Content "WireGuardServerForWindows\VersionInfo2.xml" $versionInfo
Expand Down

0 comments on commit a339153

Please sign in to comment.