Skip to content

Commit

Permalink
add branching 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 04514b3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ 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
Remove-Item ./build.ps1 ./src -ErrorAction Stop
- name: Package Bulma
run: |
./src/build.ps1 -ErrorAction Stop
Expand Down
43 changes: 24 additions & 19 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,21 @@ foreach ($release in $BulmaReleases) {
continue
}
# download
Write-Output "new release : $release"
$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"
Invoke-WebRequest -Uri $release.download -OutFile $archive
break
}
Invoke-WebRequest -Uri $release.download -OutFile $archive
$bulmaFolder = (Get-Item $archive).Basename
Remove-Item -Recurse .\assets -ErrorAction SilentlyContinue
if ( Test-Path .\assets) { throw ".\assets should not exist"}
if (Test-Path ./build.ps1) { throw ".\build.ps1 should not exist"}
git checkout -b $bulmaFolder
git status
Expand-Archive -LiteralPath $archive -DestinationPath .
if (Test-Path .\__MACOSX) { Remove-Item .\__MACOSX -ErrorAction SilentlyContinue -Recurse }
Rename-Item $bulmaFolder "assets"
if (-Not (Test-Path ./assets/bulma -PathType Container)) { throw "missing ./assets/bulma folder"}
git add assets\bulma
git commit -S -m "add $bulmaFolder"
git tag --annotate $release.version -m "release Bulma 4 HUgo v$($release.version)"
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 04514b3

Please sign in to comment.