Skip to content

Merge pull request #18 from SlashNephy/renovate/softprops-action-gh-r… #823

Merge pull request #18 from SlashNephy/renovate/softprops-action-gh-r…

Merge pull request #18 from SlashNephy/renovate/softprops-action-gh-r… #823

Workflow file for this run

name: TVTComment
on:
push:
paths:
- .github/workflows/TVTComment.yml
- Patch/TvtComment.*.patch
workflow_dispatch:
jobs:
build-exe:
runs-on: windows-latest
steps:
- name: Checkout Repository (TVTComment)
uses: actions/checkout@v4
with:
repository: noriokun4649/TVTComment
submodules: recursive
- name: Update Submodules
run: git submodule update --recursive --remote
- name: Checkout Repository (TVTComment-txt)
uses: actions/checkout@v4
with:
repository: SlashNephy/TVTComment-txt
path: TVTComment-txt
- name: Checkout Repository
uses: actions/checkout@v4
with:
path: TVTest-builder
- name: Apply Patches
shell: powershell
run: |
foreach ($item in Get-ChildItem TVTest-builder\Patch\TvtComment.*.patch)
{
Write-Output $item.FullName
git apply $item.FullName
}
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.x
- name: Replace Annict:ClientId and Annict:ClientSecret
shell: powershell
run: |
$data=Get-Content TVTComment/ViewModels/SettingsWindowViewModel.cs | % { $_ -replace 'secrets\["Annict:ClientId"\]','"${{ secrets.ANNICT_CLIENT_ID }}"' }
$data | Out-File TVTComment/ViewModels/SettingsWindowViewModel.cs
$data=Get-Content TVTComment/ViewModels/SettingsWindowViewModel.cs | % { $_ -replace 'secrets\["Annict:ClientSecret"\]','"${{ secrets.ANNICT_CLIENT_SECRET }}"' }
$data | Out-File TVTComment/ViewModels/SettingsWindowViewModel.cs
- name: Install CoreTweet
run: nuget sources add -name CoreTweetSource -source ${{ github.workspace }}\CoreTweetNuget
- name: Build
run: |
dotnet publish `
TVTComment/TVTComment.csproj `
--configuration Release `
/p:PublishProfile="TVTComment/Properties/PublishProfiles/ReleaseProfile.pubxml" `
/p:CopyLocalLockFileAssemblies=true
- name: Prepare Artifact
shell: powershell
run: |
New-Item -Path Artifact/Plugins/TvtComment -ItemType Directory
Copy-Item -Path TVTComment/bin/Release/net6.0-windows/publish/* -Destination Artifact/Plugins/TvtComment/ -Recurse
Copy-Item -Path TVTComment/Data/* -Destination Artifact/Plugins/TvtComment/ -Recurse
Copy-Item -Path TVTComment-txt/*.txt -Destination Artifact/Plugins/TvtComment/ -Recurse
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: TvtComment_exe
if-no-files-found: error
path: Artifact/
deploy-exe:
needs: build-exe
uses: ./.github/workflows/deploy.yml
with:
artifact-name: 'TvtComment_exe'
secrets: inherit
permissions: {}
build-tvtp:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
include:
- platform: x64
deploy: true
- platform: Win32
deploy: false
outputs:
artifact: ${{ steps.output.outputs.artifact }}
should_deploy: ${{ steps.output.outputs.should_deploy }}
steps:
- name: Checkout Repository (TVTComment)
uses: actions/checkout@v4
with:
repository: noriokun4649/TVTComment
submodules: recursive
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2
- name: Build
run: |
msbuild Viewer/Viewer.vcxproj `
-m `
/p:Configuration="Release" `
/p:Platform="${{ matrix.platform }}" `
/p:CodePage=932 `
/p:PlatformToolset=v143
- name: Prepare Artifacts
shell: powershell
run: |
New-Item -Path Artifact/Plugins -ItemType Directory
Copy-Item -Path Viewer/${{ matrix.platform }}/Release/TvtComment.tvtp -Destination Artifact/Plugins/
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: TvtComment_tvtp_${{ matrix.platform }}
if-no-files-found: error
path: Artifact/
- name: Set Job Outputs
id: output
uses: actions/github-script@v7
with:
script: |
core.setOutput("artifact", "TvtComment_tvtp_${{ matrix.platform }}")
core.setOutput("should_deploy", "${{ matrix.deploy }}")
deploy-tvtp:
needs: build-tvtp
if: needs.build-tvtp.outputs.should_deploy == 'true'
uses: ./.github/workflows/deploy.yml
with:
artifact-name: '${{ needs.build-tvtp.outputs.artifact }}'
secrets: inherit
permissions: {}
release:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
needs:
- build-exe
- build-tvtp
steps:
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: Artifacts/
- name: Upload Release
uses: softprops/action-gh-release@v2
with:
files: Artifacts/*.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}