From 2bc8092cca9ae9a08761abf90388aff6d4624350 Mon Sep 17 00:00:00 2001 From: Ottermandias Date: Wed, 31 May 2023 14:26:38 +0200 Subject: [PATCH] Try revamping release actions. --- .github/workflows/release.yml | 37 +++++++++++++++--------------- .github/workflows/test_release.yml | 37 +++++++++++++++--------------- 2 files changed, 36 insertions(+), 38 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 89ea2b56..267bf2dc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -24,14 +24,15 @@ jobs: Expand-Archive -Force latest.zip "$env:AppData\XIVLauncher\addon\Hooks\dev" - name: Build run: | - $ver = '${{ github.ref }}' -replace 'refs/tags/','' + $ver = '${{ github.ref_name }}' invoke-expression 'dotnet build --no-restore --configuration Release --nologo -p:Version=$ver -p:FileVersion=$ver -p:AssemblyVersion=$ver' - - name: write version into json + - name: write version into jsons run: | - $ver = '${{ github.ref }}' -replace 'refs/tags/','' + $ver = '${{ github.ref_name }}' $path = './Penumbra/bin/Release/Penumbra.json' - $content = get-content -path $path - $content = $content -replace '1.0.0.0',$ver + $json = Get-Content -Raw $path | ConvertFrom-Json + $json.AssemblyVersion = $ver + $content = $json | ConvertTo-Json set-content -Path $path -Value $content - name: Archive run: Compress-Archive -Path Penumbra/bin/Release/* -DestinationPath Penumbra.zip @@ -63,26 +64,24 @@ jobs: - name: Write out repo.json run: | - $ver = '${{ github.ref }}' -replace 'refs/tags/','' - $path = './base_repo.json' - $new_path = './repo.json' - $content = get-content -path $path - $content = $content -replace '1.0.0.0',$ver - set-content -Path $new_path -Value $content + $ver = '${{ github.ref_name }}' + $path = './repo.json' + $json = Get-Content -Raw $path | ConvertFrom-Json + $json[0].AssemblyVersion = $ver + $json[0].TestingAssemblyVersion = $ver + $json[0].DownloadLinkInstall = $json.DownloadLinkInstall -replace '[^/]+/Penumbra.zip',"$ver/Penumbra.zip" + $json[0].DownloadLinkTesting = $json.DownloadLinkTesting -replace '[^/]+/Penumbra.zip',"$ver/Penumbra.zip" + $json[0].DownloadLinkUpdate = $json.DownloadLinkUpdate -replace '[^/]+/Penumbra.zip',"$ver/Penumbra.zip" + $content = $json | ConvertTo-Json + set-content -Path $path -Value $content - name: Commit repo.json run: | git config --global user.name "Actions User" git config --global user.email "actions@github.com" - git fetch origin master - git fetch origin test - git branch -f test ${{ github.sha }} + git branch -f master ${{ github.sha }} git checkout master git add repo.json - git commit -m "[CI] Updating repo.json for ${{ github.ref }}" || true - + git commit -m "[CI] Updating repo.json for ${{ github.ref_name }}" || true git push origin master - git branch -f test origin/master - git checkout test - git push origin test -f || true diff --git a/.github/workflows/test_release.yml b/.github/workflows/test_release.yml index 6ae471be..6175f3c1 100644 --- a/.github/workflows/test_release.yml +++ b/.github/workflows/test_release.yml @@ -24,14 +24,15 @@ jobs: Expand-Archive -Force latest.zip "$env:AppData\XIVLauncher\addon\Hooks\dev" - name: Build run: | - $ver = '${{ github.ref }}' -replace 'refs/tags/t','' + $ver = '${{ github.ref_name }}' -replace 't' invoke-expression 'dotnet build --no-restore --configuration Debug --nologo -p:Version=$ver -p:FileVersion=$ver -p:AssemblyVersion=$ver' - name: write version into json run: | - $ver = '${{ github.ref }}' -replace 'refs/tags/t','' + $ver = '${{ github.ref_name }}' -replace 't' $path = './Penumbra/bin/Debug/Penumbra.json' - $content = get-content -path $path - $content = $content -replace '1.0.0.0',$ver + $json = Get-Content -Raw $path | ConvertFrom-Json + $json.AssemblyVersion = $ver + $content = $json | ConvertTo-Json set-content -Path $path -Value $content - name: Archive run: Compress-Archive -Path Penumbra/bin/Debug/* -DestinationPath Penumbra.zip @@ -63,24 +64,22 @@ jobs: - name: Write out repo.json run: | - $ver = '${{ github.ref }}' -replace 'refs/tags/t','' - $ver2 = '${{ github.ref }}' -replace 'refs/tags/','' - $path = './base_repo.json' - $new_path = './repo.json' - $content = get-content -path $path - $content = $content -replace '/1.0.0.0/',"/$ver2/" - $content = $content -replace '1.0.0.0',$ver - set-content -Path $new_path -Value $content + $verT = '${{ github.ref_name }}' + $ver = $verT -replace 't' + $path = './repo.json' + $json = Get-Content -Raw $path | ConvertFrom-Json + $json[0].TestingAssemblyVersion = $ver + $json[0].DownloadLinkTesting = $json.DownloadLinkTesting -replace '[^/]+/Penumbra.zip',"$verT/Penumbra.zip" + $content = $json | ConvertTo-Json + set-content -Path $path -Value $content - name: Commit repo.json run: | git config --global user.name "Actions User" git config --global user.email "actions@github.com" - - git fetch origin test - git branch -f test ${{ github.sha }} - git checkout test + git fetch origin master + git branch -f master ${{ github.sha }} + git checkout master git add repo.json - git commit -m "[CI] Updating repo.json for ${{ github.ref }}" || true - - git push origin test -f || true + git commit -m "[CI] Updating repo.json for ${{ github.ref_name }}" || true + git push origin master