Try revamping release actions.

This commit is contained in:
Ottermandias 2023-05-31 14:26:38 +02:00
parent 381ab4befe
commit 2bc8092cca
2 changed files with 36 additions and 38 deletions

View file

@ -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

View file

@ -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