Skip to content

Commit

Permalink
ci: update to incremental version-date when needed
Browse files Browse the repository at this point in the history
- Fix some actions warning
- Pass sha & version to Starfield-RE-vcpkg
- Fix ps version requirement
- Add proper co-author with bot
  • Loading branch information
FlayaN committed Sep 9, 2023
1 parent 2be1a4b commit 80ed987
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
21 changes: 17 additions & 4 deletions .github/update-registry.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Requires -Version 5
#Requires -Version 7.1

# args
param (
Expand All @@ -7,7 +7,7 @@ param (

# test-path
if (!(Test-Path "$PathIn/CommonLibSF") -or !(Test-Path "$PathIn/CommonLibSF/vcpkg.json") -or !(Test-Path "$PathIn/README.md")) {
Write-Output "::set-output name=VCPKG_SUCCESS::false"
Write-Output "VCPKG_SUCCESS=false" >> $env:GITHUB_OUTPUT
exit
}

Expand All @@ -16,6 +16,19 @@ $version = (Get-Date -AsUTC -Format "yyyy-MM-dd")

# update vcpkg
$vcpkg = [IO.File]::ReadAllText("$PathIn/CommonLibSF/vcpkg.json") | ConvertFrom-Json

$currVersion = $vcpkg.'version-date'

if($currVersion.Contains($version)) {
$version = if ($currVersion.Contains('.')) {
$identifiers = $currVersion.Split('.')
"$($identifiers[0]).$([Int32]$identifiers[1] + 1)"
}
else {
"$($currVersion).1"
}
}

$vcpkg.'version-date' = $version
$vcpkg = $vcpkg | ConvertTo-Json -Depth 9 | ForEach-Object { $_ -replace "(?m) (?<=^(?: )*)", " " }
[IO.File]::WriteAllText("$PathIn/CommonLibSF/vcpkg.json", $vcpkg)
Expand All @@ -26,5 +39,5 @@ $readme = $readme -replace "(?<=label=vcpkg%20registry&message=).+?(?=&color)",
[IO.File]::WriteAllLines("$PathIn/README.md", $readme)

# status
Write-Output "::set-output name=VCPKG_SUCCESS::true"
Write-Output "::set-output name=VCPKG_VERSION::$version"
Write-Output "VCPKG_SUCCESS=true" >> $env:GITHUB_OUTPUT
Write-Output "VCPKG_VERSION=$version" >> $env:GITHUB_OUTPUT
6 changes: 3 additions & 3 deletions .github/workflows/maintenance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ jobs:
- name: Check for Commit
uses: EndBug/add-and-commit@v9
with:
author_name: maintenance
committer_name: maintenance
committer_email: 41898282+github-actions[bot]@users.noreply.github.com
message: "ci: maintenance `${{ steps.versioning.outputs.VCPKG_VERSION }}`"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Repository Dispatch
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.VCPKG_HELPER_TOKEN }}
repository: ${{ github.repository_owner }}/Starfield-RE-vcpkg
event-type: update-event
client-payload: '{"sha": "${{ github.sha }}", "vcpkg-version": "${{ steps.versioning.outputs.VCPKG_VERSION }}"}'

0 comments on commit 80ed987

Please sign in to comment.