-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
78 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Generate Plugin Index | ||
|
||
on: | ||
push: | ||
|
||
jobs: | ||
|
||
build: | ||
runs-on: windows-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: List files | ||
run: ls | ||
|
||
- name: Install Index Generator | ||
run: | | ||
Invoke-WebRequest -Uri https://github.com/ClassIsland/ClassIsland.PluginIndexGenerator/releases/download/latest/ClassIsland.PluginIndexGenerator.zip -OutFile ClassIsland.PluginIndexGenerator.zip | ||
Expand-Archive -Path ClassIsland.PluginIndexGenerator.zip -DestinationPath . | ||
- name: Generate Plugin Index | ||
run: | | ||
mkdir out/source/ | ||
./ClassIsland.PluginIndexGenerator.exe index out/source/index.json -b base.json | ||
7z a "./out/index.zip" ./out/source/* -r -mx=9 | ||
rm -r -Force out/source/ | ||
- name: Generate MD5 | ||
run: | | ||
pwsh -ep Bypass -c .\tools\generate-md5.ps1 ./out | ||
- name: Upload to release | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
tag: latest | ||
artifacts: ./out/*.zip,./out/*.md5sum | ||
bodyFile: ./out/checksums.md | ||
token: ${{ secrets.GITHUB_TOKEN }} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
param($path) | ||
|
||
echo $path | ||
rm $path/*.md5sum | ||
$files = Get-ChildItem $path | ||
$hashes = [ordered]@{} | ||
$summary = " | ||
> [!important] | ||
> 下载时请注意核对文件MD5是否正确。 | ||
| 文件名 | MD5 | | ||
| --- | --- | | ||
" | ||
|
||
foreach ($i in $files) { | ||
$name = $i.Name | ||
$hash = Get-FileHash $i -Algorithm MD5 | ||
$hashString = $hash.Hash | ||
$hashes.Add($name, $hashString) | ||
Write-Output $hash.Hash > "${i}.md5sum" | ||
$summary += "| $name | ``${hashString}`` |`n" | ||
} | ||
|
||
echo $hashes | ||
|
||
$json = ConvertTo-Json $hashes -Compress | ||
|
||
$summary += "`n<!-- CLASSISLAND_PKG_MD5 ${json} -->" | ||
echo $summary > "$path/checksums.md" | ||
Write-Host "MD5 Summary:" -ForegroundColor Gray | ||
Write-Host $summary -ForegroundColor Gray | ||
Write-Host "----------" -ForegroundColor Gray | ||
|
||
#if (-not $GITHUB_ACTION -eq $null) { | ||
# 'MD5_SUMMARY=' + $summary.Replace("`n", "<<") | Out-File -FilePath $env:GITHUB_ENV -Append | ||
#} |