Skip to content

Commit

Permalink
Merge pull request #43 from theohbrothers/refactor/ci-use-new-version…
Browse files Browse the repository at this point in the history
…s.json-config

Refactor (ci): Use new `versions.json` config
  • Loading branch information
leojonathanoh committed Sep 21, 2023
2 parents a9354b0 + 1c06d80 commit 86a6aa8
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 28 deletions.
11 changes: 2 additions & 9 deletions Update-Versions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,10 @@ try {
Push-Location $repo
}

# Get my versions from generate/definitions/versions.json
$versions = Get-Content $PSScriptRoot/generate/definitions/versions.json -Encoding utf8 | ConvertFrom-Json
# Get new versions
$versionsNew = Invoke-WebRequest https://api.github.com/repos/OpenVPN/easy-rsa/git/refs/tags | ConvertFrom-Json | % { $_.ref -replace 'refs/tags/v', ''} | ? { $_ -match '^\d+\.\d+\.\d+$' } | Sort-Object { [version]$_ } -Descending
# Get changed versions
$scope = 'patch'
$versionsChanged = Get-VersionsChanged -Versions $versions -VersionsNew $versionsNew -ChangeScope $scope -AsObject -Descending
# Update versions.json, and open PRs with CI disabled
$prs = Update-DockerImageVariantsVersions -VersionsChanged $versionsChanged -CommitPreScriptblock { Move-Item .github .github.disabled -Force } -PR:$PR -WhatIf:$WhatIfPreference
$prs = Update-DockerImageVariantsVersions -CommitPreScriptblock { Move-Item .github .github.disabled -Force } -PR:$PR -WhatIf:$WhatIfPreference
# Update versions.json, update PRs with CI, merge PRs one at a time, release and close milestone
$return = Update-DockerImageVariantsVersions -VersionsChanged $versionsChanged -PR:$PR -AutoMergeQueue:$AutoMergeQueue -AutoRelease:$AutoRelease -AutoReleaseTagConvention $AutoReleaseTagConvention -WhatIf:$WhatIfPreference
$return = Update-DockerImageVariantsVersions -PR:$PR -AutoMergeQueue:$AutoMergeQueue -AutoRelease:$AutoRelease -AutoReleaseTagConvention $AutoReleaseTagConvention -WhatIf:$WhatIfPreference
}catch {
throw
}finally {
Expand Down
2 changes: 1 addition & 1 deletion generate/definitions/VARIANTS.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ $local:VERSIONS = @( Get-Content $PSScriptRoot/versions.json -Encoding utf8 -raw

# Docker image variants' definitions
$local:VARIANTS_MATRIX = @(
foreach ($v in $local:VERSIONS) {
foreach ($v in $local:VERSIONS.easyrsa.versions) {
@{
package = 'easy-rsa'
package_version = $v
Expand Down
42 changes: 24 additions & 18 deletions generate/definitions/versions.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
[
"3.1.6",
"3.1.5",
"3.1.4",
"3.1.3",
"3.1.2",
"3.1.1",
"3.1.0",
"3.0.9",
"3.0.8",
"3.0.7",
"3.0.6",
"3.0.5",
"3.0.4",
"3.0.3",
"3.0.2",
"3.0.1"
]
{
"easyrsa": {
"versions": [
"3.1.6",
"3.1.5",
"3.1.4",
"3.1.3",
"3.1.2",
"3.1.1",
"3.1.0",
"3.0.9",
"3.0.8",
"3.0.7",
"3.0.6",
"3.0.5",
"3.0.4",
"3.0.3",
"3.0.2",
"3.0.1"
],
"versionsChangeScope": "patch",
"versionsNewScript": "Invoke-WebRequest https://api.github.com/repos/OpenVPN/easy-rsa/git/refs/tags | ConvertFrom-Json | % { $_.ref -replace 'refs/tags/v', ''} | ? { $_ -match '^\\d+\\.\\d+\\.\\d+$' } | Sort-Object { [version]$_ } -Descending"
}
}

0 comments on commit 86a6aa8

Please sign in to comment.