Skip to content

Commit

Permalink
update workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
Scighost committed Jan 13, 2025
1 parent 28e5b68 commit c130d00
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 13 deletions.
22 changes: 14 additions & 8 deletions .github/workflows/publish_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,43 +52,49 @@ jobs:
- name: Build
run: ./build.ps1 -Architecture $env:Platform -Version $env:Version -Dev

- name: Metadata
- name: Create Metadata
run: ./metadata.ps1 -Architecture $env:Platform -Version $env:Version -Dev

- name: Setup OssUtil
run: |
Invoke-WebRequest https://gosspublic.alicdn.com/ossutil/1.7.15/ossutil-v1.7.15-windows-amd64.zip -OutFile ${{runner.temp}}/ossutil.zip
Invoke-WebRequest https://gosspublic.alicdn.com/ossutil/1.7.19/ossutil-v1.7.19-windows-amd64.zip -OutFile ${{runner.temp}}/ossutil.zip
Expand-Archive -Path ${{runner.temp}}/ossutil.zip -DestinationPath ${{runner.temp}}
Move-Item -Path ${{runner.temp}}/ossutil-v1.7.15-windows-amd64/ossutil64.exe -Destination C:/Windows/System32/ossutil.exe -Force
Move-Item -Path ${{runner.temp}}/ossutil-v1.7.19-windows-amd64/ossutil64.exe -Destination C:/Windows/System32/ossutil.exe -Force
ossutil config -e ${{ secrets.OSS_ENDPOINT }} -i ${{ secrets.ACCESS_KEY_ID }} -k ${{ secrets.ACCESS_KEY_SECRET }}
- name: Upload to OSS
run: ossutil cp -rf ./build/release/ oss://starward/release/ --meta Content-Type:multipart/mixed

- name: Upload Artifact
uses: actions/upload-artifact@v3.1.2
- name: Upload Metadata
uses: actions/upload-artifact@v4
with:
name: metadata_${{ matrix.platform }}
path: build/metadata/

- name: Upload Release
uses: actions/upload-artifact@v4
with:
name: Starward_Portable_${{ needs.version.outputs.version }}_${{ matrix.platform }}
path: build/release/package/dev/Starward_Portable_${{ needs.version.outputs.version }}_${{ matrix.platform }}.7z


metadata:
runs-on: ubuntu-latest
needs: build

steps:
- name: Checkout Metadata
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: metadata

- name: Download Artifact x64
uses: actions/download-artifact@v3.0.2
uses: actions/download-artifact@v4
with:
name: metadata_x64

- name: Download Artifact arm64
uses: actions/download-artifact@v3.0.2
uses: actions/download-artifact@v4
with:
name: metadata_arm64

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/publish_preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,20 @@ jobs:
- name: Build
run: ./build.ps1 -Architecture $env:Platform -Version $env:Version

- name: Metadata
- name: Create Metadata
run: ./metadata.ps1 -Architecture $env:Platform -Version $env:Version

- name: Setup OssUtil
run: |
Invoke-WebRequest https://gosspublic.alicdn.com/ossutil/1.7.15/ossutil-v1.7.15-windows-amd64.zip -OutFile ${{runner.temp}}/ossutil.zip
Invoke-WebRequest https://gosspublic.alicdn.com/ossutil/1.7.19/ossutil-v1.7.19-windows-amd64.zip -OutFile ${{runner.temp}}/ossutil.zip
Expand-Archive -Path ${{runner.temp}}/ossutil.zip -DestinationPath ${{runner.temp}}
Move-Item -Path ${{runner.temp}}/ossutil-v1.7.15-windows-amd64/ossutil64.exe -Destination C:/Windows/System32/ossutil.exe -Force
Move-Item -Path ${{runner.temp}}/ossutil-v1.7.19-windows-amd64/ossutil64.exe -Destination C:/Windows/System32/ossutil.exe -Force
ossutil config -e ${{ secrets.OSS_ENDPOINT }} -i ${{ secrets.ACCESS_KEY_ID }} -k ${{ secrets.ACCESS_KEY_SECRET }}
- name: Upload to OSS
run: ossutil cp -rf ./build/release/ oss://starward/release/ --meta Content-Type:multipart/mixed

- name: Upload Artifact
- name: Upload Metadata
uses: actions/upload-artifact@v4
with:
name: metadata_${{ matrix.platform }}
Expand Down
6 changes: 5 additions & 1 deletion metadata.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,21 @@ $build = "build";
$starward = "$build/Starward";
if ($Dev) {
$metadata = "$build/metadata/dev";
$history = "$build/metadata/dev/history";
$package = "$build/release/package/dev";
$separate = "$build/release/separate_files/dev";
}
else {
$metadata = "$build/metadata/v1";
$history = "$build/metadata/v1/history";
$package = "$build/release/package";
$separate = "$build/release/separate_files";
}

$null = New-Item -Path $package -ItemType Directory -Force;
$null = New-Item -Path $separate -ItemType Directory -Force;
$null = New-Item -Path $metadata -ItemType Directory -Force;
$null = New-Item -Path $history -ItemType Directory -Force;

if (!(Get-Module -Name 7Zip4Powershell -ListAvailable)) {
Install-Module -Name 7Zip4Powershell -Force;
Expand All @@ -34,7 +37,7 @@ if (!(Test-Path $portableFile)) {
Compress-7Zip -ArchiveFileName $portableName -Path $starward -OutputPath $package -CompressionLevel Ultra -PreserveDirectoryRoot;
}

$release = @{
$release = [ordered]@{
Version = $Version
Architecture = $Architecture
BuildTime = Get-Date
Expand Down Expand Up @@ -62,6 +65,7 @@ $hash = @{l = "Hash"; e = { (Get-FileHash $_).Hash } };
$release.SeparateFiles = Get-ChildItem -Path $starward -File -Recurse | Select-Object -Property $path, $size, $hash;

Out-File -Path "$metadata/release_preview_$Architecture.json" -InputObject (ConvertTo-Json $release);
Copy-Item -Path "$metadata/release_preview_$Architecture.json" -Destination "$history/release_$($Version)_$Architecture.json" -Force;

foreach ($file in $release.SeparateFiles) {
Move-Item -Path "$starward/$($file.Path)" -Destination "$separate/$($file.Hash)" -Force;
Expand Down

0 comments on commit c130d00

Please sign in to comment.