Oops forgor #23
Workflow file for this run
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
name: Create Release | |
on: | |
push: | |
tags-ignore: | |
- testing_* | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: '8.x.x' | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Download Dalamud | |
run: | | |
Invoke-WebRequest -Uri https://goatcorp.github.io/dalamud-distrib/stg/latest.zip -OutFile latest.zip | |
Expand-Archive -Force latest.zip "$env:AppData\XIVLauncher\addon\Hooks\dev" | |
- name: Build | |
run: | | |
$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 jsons | |
run: | | |
$ver = '${{ github.ref_name }}' | |
$path = './PetNicknames/bin/x64/Release/PetNicknames.json' | |
$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 PetNicknames/bin/x64/Release/* -DestinationPath PetNicknames.zip | |
- name: Upload a Build Artifact | |
uses: actions/[email protected] | |
with: | |
path: | | |
./PetNicknames/bin/x64/Release/* | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: PetNicknames ${{ github.ref }} | |
draft: false | |
prerelease: false | |
- name: Upload Release Asset | |
id: upload-release-asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | |
asset_path: ./PetNicknames.zip | |
asset_name: PetNicknames.zip | |
asset_content_type: application/zip | |
- name: Write out PetNicknames.json | |
run: | | |
$ver = '${{ github.ref_name }}' | |
$path = './PetNicknames.json' | |
$json = Get-Content -Raw $path | ConvertFrom-Json | |
$json[0].AssemblyVersion = $ver | |
$json[0].TestingAssemblyVersion = $ver | |
$json[0].DownloadLinkInstall = $json.DownloadLinkInstall -replace '[^/]+/PetNicknames.zip',"$ver/PetNicknames.zip" | |
$json[0].DownloadLinkTesting = $json.DownloadLinkTesting -replace '[^/]+/PetNicknames.zip',"$ver/PetNicknames.zip" | |
$json[0].DownloadLinkUpdate = $json.DownloadLinkUpdate -replace '[^/]+/PetNicknames.zip',"$ver/PetNicknames.zip" | |
$content = $json | ConvertTo-Json -AsArray | |
set-content -Path $path -Value $content | |
- name: Commit PetNicknames.json | |
run: | | |
git config --global user.name "Actions User" | |
git config --global user.email "[email protected]" | |
git fetch origin main | |
git branch -f main ${{ github.sha }} | |
git checkout main | |
git add PetNicknames.json | |
git commit -m "[CI] Updating PetNicknames.json for ${{ github.ref_name }}" || true | |
git push origin main |