build: 6.8.0-0 #703
This file contains hidden or 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
| name: Build XIVLauncher | |
| on: [push, pull_request] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build-release: | |
| name: Build Release on Windows | |
| runs-on: windows-2022 | |
| permissions: | |
| id-token: write | |
| contents: write # Must be 'write' to create a release | |
| attestations: write | |
| steps: | |
| - uses: actions/checkout@v1 | |
| - name: Initialize Submodules | |
| run: git submodule update --init --recursive | |
| - name: Restore Nuget Packages | |
| run: | | |
| cd .\src\ | |
| dotnet restore | |
| cd .. | |
| - name: Define VERSION | |
| run: | | |
| $env:COMMIT = $env:GITHUB_SHA.Substring(0, 7) | |
| $env:REPO_NAME = $env:GITHUB_REPOSITORY -replace '.*/' | |
| $env:BRANCH = $env:GITHUB_REF -replace '.*/' | |
| ($env:REPO_NAME) >> VERSION | |
| ($env:BRANCH) >> VERSION | |
| ($env:COMMIT) >> VERSION | |
| - name: Build Release | |
| run: | | |
| cd "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\" | |
| .\MSBuild.exe $Env:GITHUB_WORKSPACE\src\XIVLauncher.sln /t:Build /p:Configuration=Release | |
| - name: Generate Hashes File | |
| run: .\scripts\CreateHashList.ps1 .\src\bin\win-x64 | |
| - name: Attest Artifacts | |
| if: ${{ github.repository_owner == 'ottercorp' && github.event_name == 'push' }} | |
| uses: actions/attest-build-provenance@v1 | |
| with: | |
| subject-path: | | |
| src/bin/XIVLauncher.exe | |
| src/bin/XIVLauncher.*.dll | |
| src/bin/XIVLauncher.*.exe | |
| src/bin/hashes.json | |
| - name: Velopack Build and Upload | |
| id: build-velopack | |
| env: | |
| S3AccessKeyID: ${{ secrets.S3ACCESSKEYID }} | |
| S3AccessKeySecret: ${{ secrets.S3ACCESSKEYSECRET }} | |
| S3Bucket: ${{ secrets.S3BUCKET }} | |
| S3Endpoint: ${{ secrets.S3ENDPOINT }} | |
| run: | | |
| $channel = "win" | |
| $refver = $env:GITHUB_REF -replace '.*/' | |
| $desc = $(git describe --tags) -replace '-(\d+)-.{9}$','.beta.$1' | |
| if ($refver -ne $desc) { | |
| $channel = "beta" | |
| $timestamp = git log -1 --format=%at | |
| # 获取 Git 提交时间(Unix 时间戳) | |
| $timestamp = git log -1 --format=%at | |
| $datePart = Get-Date -Date ([datetime]::UnixEpoch).AddSeconds($timestamp) -Format "yyyyMMddHHmm" | |
| $refver = $(git describe --tags) -replace '^(\d+\.\d+\.\d+-\d+).*','$1.beta.' | |
| $refver = $refver + $datePart | |
| } | |
| echo "::set-output name=version::$refver" | |
| cd src\ | |
| mkdir Releases | |
| dotnet tool install -g vpk | |
| vpk download s3 --channel $channel --bucket $env:S3Bucket --endpoint $env:S3Endpoint --keyId $env:S3AccessKeyID --secret $env:S3AccessKeySecret | |
| vpk pack -u XIVLauncherCN -v $refver -p .\bin\win-x64 -o .\Releases -e XIVLauncherCN.exe --channel $channel --packAuthors OtterCorp --releaseNotes .\XIVLauncher\Resources\CHANGELOG.txt --icon .\XIVLauncher\Resources\dalamud_icon.ico --splashImage .\XIVLauncher\Resources\logo.png --framework net10.0-x64-desktop | |
| Expand-Archive -Path ".\Releases\XIVLauncherCN-$channel-Portable.zip" -DestinationPath .\Releases\scratch -Force | |
| 7z a .\Releases\XIVLauncherCN-$channel-Portable.7z .\Releases\scratch\* -t7z -mx=9 | |
| $json = Get-Content -Raw .\Releases\assets.$channel.json | ConvertFrom-Json | |
| foreach ($file in $json) { | |
| $file.RelativeFileName = $file.RelativeFileName -replace 'zip', '7z' | |
| } | |
| $content = $json | ConvertTo-Json | |
| set-content -Path .\Releases\assets.$channel.json -Value $content | |
| vpk upload s3 --channel $channel --bucket $env:S3Bucket --endpoint $env:S3Endpoint --keyId $env:S3AccessKeyID --secret $env:S3AccessKeySecret --keepMaxReleases 5 | |
| Remove-Item -Force .\Releases\*.zip | |
| Remove-Item -Force .\Releases\*.exe | |
| Remove-Item -Force -Recurse .\Releases\scratch | |
| - name: Attest Setup | |
| if: ${{ github.repository_owner == 'ottercorp' && github.event_name == 'push' }} | |
| uses: actions/attest-build-provenance@v1 | |
| with: | |
| subject-path: | | |
| src/Releases/*.nupkg | |
| src/Releases/*.json | |
| src/Releases/*.7z | |
| - name: Create Release | |
| if: startsWith(github.ref, 'refs/tags/') | |
| uses: softprops/action-gh-release@a74c6b72af54cfa997e81df42d94703d6313a2d0 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| files: ./src/Releases/** | |
| name: Release ${{ steps.build-velopack.outputs.version }} | |
| body_path: RELEASE.md | |
| prerelease: true | |
| - name: VirusTotal Scan | |
| uses: crazy-max/ghaction-virustotal@a3f74cfd584b0658320aec5e94ab6a8d16dca05f | |
| with: | |
| vt_api_key: ${{ secrets.VT_API_KEY }} | |
| files: | | |
| ./src/Releases/*.7z | |
| - name: Clear Web Services cache | |
| run: curl -X POST --fail https://aonyx.ffxiv.wang/Proxy/ClearCache?key=$env:CACHE_CLEAR_KEY | |
| env: | |
| CACHE_CLEAR_KEY: ${{ secrets.CACHE_CLEAR_KEY }} |