From 1bb9bb8a9a5ba8b3f9d7c39b28dde8b9f48325e4 Mon Sep 17 00:00:00 2001 From: RisaDev <151885272+RisaDev@users.noreply.github.com> Date: Thu, 11 Jan 2024 21:42:52 +0300 Subject: [PATCH] Build workflows --- .github/workflows/release.yml | 87 ++++++++++++++++++++++++++++++ .github/workflows/test_release.yml | 85 +++++++++++++++++++++++++++++ CustomizePlus/CustomizePlus.csproj | 3 +- README.md | 1 + repo.json | 30 +++++++++++ 5 files changed, 205 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/test_release.yml create mode 100644 repo.json diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..5681801 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,87 @@ +name: Create Release + +on: + push: + tags-ignore: + - testing_* + +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: '7.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 = './CustomizePlus/bin/Release/CustomizePlus.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 CustomizePlus/bin/Release/* -DestinationPath CustomizePlus.zip + - name: Upload a Build Artifact + uses: actions/upload-artifact@v2.2.1 + with: + path: | + ./CustomizePlus/bin/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: CustomizePlus ${{ 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: ./CustomizePlus.zip + asset_name: CustomizePlus.zip + asset_content_type: application/zip + + - name: Write out repo.json + run: | + $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 '[^/]+/CustomizePlus.zip',"$ver/CustomizePlus.zip" + $json[0].DownloadLinkTesting = $json.DownloadLinkTesting -replace '[^/]+/CustomizePlus.zip',"$ver/CustomizePlus.zip" + $json[0].DownloadLinkUpdate = $json.DownloadLinkUpdate -replace '[^/]+/CustomizePlus.zip',"$ver/CustomizePlus.zip" + $content = $json | ConvertTo-Json -AsArray + 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 main + git branch -f main ${{ github.sha }} + git checkout main + git add repo.json + git commit -m "[CI] Updating repo.json for ${{ github.ref_name }}" || true + git push origin main diff --git a/.github/workflows/test_release.yml b/.github/workflows/test_release.yml new file mode 100644 index 0000000..1d4e107 --- /dev/null +++ b/.github/workflows/test_release.yml @@ -0,0 +1,85 @@ +name: Create Test Release + +on: + push: + tags: + - testing_* + +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: '7.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 }}' -replace 'testing_' + 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_name }}' -replace 'testing_' + $path = './CustomizePlus/bin/Debug/CustomizePlus.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 CustomizePlus/bin/Debug/* -DestinationPath CustomizePlus.zip + - name: Upload a Build Artifact + uses: actions/upload-artifact@v2.2.1 + with: + path: | + ./CustomizePlus/bin/Debug/* + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: CustomizePlus ${{ 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: ./CustomizePlus.zip + asset_name: CustomizePlus.zip + asset_content_type: application/zip + + - name: Write out repo.json + run: | + $verT = '${{ github.ref_name }}' + $ver = $verT -replace 'testing_' + $path = './repo.json' + $json = Get-Content -Raw $path | ConvertFrom-Json + $json[0].TestingAssemblyVersion = $ver + $json[0].DownloadLinkTesting = $json.DownloadLinkTesting -replace '[^/]+/CustomizePlus.zip',"$verT/CustomizePlus.zip" + $content = $json | ConvertTo-Json -AsArray + 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 main + git branch -f main ${{ github.sha }} + git checkout main + git add repo.json + git commit -m "[CI] Updating repo.json for ${{ github.ref_name }}" || true + git push origin main diff --git a/CustomizePlus/CustomizePlus.csproj b/CustomizePlus/CustomizePlus.csproj index bf35d6f..3f9651c 100644 --- a/CustomizePlus/CustomizePlus.csproj +++ b/CustomizePlus/CustomizePlus.csproj @@ -21,6 +21,7 @@ false false true + bin\$(Configuration)\ @@ -45,7 +46,7 @@ - + all diff --git a/README.md b/README.md index 6c46768..8609f3c 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,7 @@ We expect contributed code to adhere to the code style of already existing code * User interface and general plugin architecture is heavily based on the code written as a part of [Glamourer](https://github.com/Ottermandias/Glamourer) and [OtterGui](https://github.com/Ottermandias/OtterGui/) projects. Original code is licensed under Apache License 2.0. * Bone manipulation code is based on the code contributed to Customize+ 1.x by [dendr01d](https://github.com/dendr01d/). * Some of the game object interaction code is copied from [Penumbra](https://github.com/xivdev/Penumbra) and [Glamourer](https://github.com/Ottermandias/Glamourer) projects in order to make Customize+ not rely on Penumbra being installed. +* GitHub workflows have been taken from [Glamourer](https://github.com/Ottermandias/Glamourer) project. * Everyone who contributed code and features through pull requests. ## License diff --git a/repo.json b/repo.json new file mode 100644 index 0000000..26736b5 --- /dev/null +++ b/repo.json @@ -0,0 +1,30 @@ +[ + { + "Author": "Risa", + "Name": "Customize+", + "Description": "A plugin that allows you to customize your character beyond FFXIV limitations by directly editing bone parameters.", + "Punchline": "Customize your character beyond FFXIV's limitations.", + "InternalName": "CustomizePlus", + "AssemblyVersion": "1.2.7.0", + "TestingAssemblyVersion": "2.0.0.2", + "RepoUrl": "https://github.com/Aether-Tools/CustomizePlus", + "ApplicableVersion": "any", + "DalamudApiLevel": 9, + "IsHide": "False", + "IsTestingExclusive": "False", + "DownloadCount": 0, + "LastUpdate": 0, + "LoadPriority": 0, + "DownloadLinkInstall": "https://github.com/Aether-Tools/CustomizePlus/releases/download/1.2.7.0/CustomizePlus.zip", + "DownloadLinkUpdate": "https://github.com/Aether-Tools/CustomizePlus/releases/download/1.2.7.0/CustomizePlus.zip", + "DownloadLinkTesting": "https://github.com/Aether-Tools/CustomizePlus/releases/download/testing_2.0.0.2/CustomizePlus.zip", + "IconUrl": "https://raw.githubusercontent.com/Aether-Tools/CustomizePlus/main/Data/icon.png", + "Tags": [ + "Anamnesis", + "Customization", + "Appearance", + "Character", + "Risa" + ] + } +] \ No newline at end of file