Skip to content

Commit

Permalink
add brnching and tagging
Browse files Browse the repository at this point in the history
  • Loading branch information
irkode committed Jul 27, 2024
1 parent a18f38e commit cbc53a8
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 19 deletions.
1 change: 0 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ jobs:
$PSVersionTable | Format-List | Out-Host
[void](New-Item -Type Directory ./src -ErrorAction Stop)
Copy-Item ./build.ps1 ./src -ErrorAction Stop
Remove-Item ./build.ps1 -ErrorAction Stop
- name: Package Bulma
run: |
./src/build.ps1 -ErrorAction Stop
Expand Down
46 changes: 28 additions & 18 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@ $BULMA_URL = "https://api.github.com/repos/jgthms/bulma"

# get releases and extract needed information
$BulmaReleases = Invoke-RestMethod -FollowRelLink -Uri "$BULMA_URL/releases?per_page=100" | %{$_}| ForEach-Object {
[PSCustomObject]@{
version = [version]$_.tag_name
archive = [string]$_.assets.name
download = [string]$_.assets.browser_download_url
if ($_.tag_name) {
[PSCustomObject]@{
version = [version]$_.tag_name
archive = [string]$_.assets.name
download = [string]$_.assets.browser_download_url
}
} else {
Write-Warning "found untagged release for $($_.assets.name)"
}
} | Sort-Object -Property version
$tags = git tag
Expand All @@ -17,20 +21,26 @@ foreach ($release in $BulmaReleases) {
continue
}
# download
$archive = Join-Path -Path $TEMPDIR -ChildPath $release.archive
if (Test-Path -Path $archive) {
Write-Output "is downloaded : $release"
continue
} else {
Write-Output "new release : $release"
Write-Output "new release : $release"
try {
$archive = Join-Path -Path $TEMPDIR -ChildPath $release.archive
Invoke-WebRequest -Uri $release.download -OutFile $archive
break
$bulmaFolder = (Get-Item $archive).Basename
Remove-Item -Recurse .\assets -ErrorAction SilentlyContinue
if ( Test-Path .\assets) { throw ".\assets should not exist"}
Remove-Item ./build.ps1 -ErrorAction SilentlyContinue
if (Test-Path ./build.ps1) { throw ".\build.ps1 should not exist"}
git checkout -b $bulmaFolder
Expand-Archive -LiteralPath $archive -DestinationPath . -ErrorAction Stop
Remove-Item __MACOSX -ErrorAction SilentlyContinue -Recurse
Rename-Item $bulmaFolder "assets" -ErrorAction Stop
if (-Not (Test-Path ./assets/bulma -PathType Container)) { throw "missing ./assets/bulma folder"}
git add assets\bulma .\build.ps1
git commit -S -m "add $bulmaFolder"
git tag --annotate $release.version -m "release Bulma 4 HUgo v$($release.version)"
} catch {
Write-Error "packing of Bulma release $($release.version) failed"
throw "$_"
}
break
}
$bulmaFolder = (Get-Item $archive).Basename
[void](Remove-Item -Recurse .\assets -ErrorAction SilentlyContinue)
if ( Test-Path .\assets) { throw ".\assets should not exist"}
Expand-Archive -LiteralPath $archive -DestinationPath .
Rename-Item $bulmaFolder "assets"
[void](Remove-Item __MACOSX -ErrorAction SilentlyContinue -Recurse)
git status

0 comments on commit cbc53a8

Please sign in to comment.