Update daily.yml #116
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: Build Daily | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
build: | |
runs-on: windows-latest | |
name: Shoko Desktop daily build | |
env: | |
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | |
steps: | |
- uses: actions/checkout@master | |
with: | |
submodules: recursive | |
- name: Setup MSBuild Path | |
uses: warrenbuckley/Setup-MSBuild@v1 | |
- name: Setup NuGet | |
uses: NuGet/[email protected] | |
- name: Restore NuGet Packages | |
run: nuget restore Shoko.Desktop.sln | |
- name: Build | |
run: msbuild Shoko.Desktop.sln /p:Configuration=Release /p:DeployOnBuild=true /p:PublishProfile=FolderProfile | |
- name: Upload Artifact | |
uses: actions/[email protected] | |
with: | |
name: ShokoDesktop | |
path: Shoko.Desktop\bin\Release | |
- name: Archive Release | |
shell: pwsh | |
run: Compress-Archive .\\Shoko.Desktop\\bin\\Release .\\ShokoDesktop.zip | |
- name: Install PSFTP (SFTP Client) | |
run: | | |
Invoke-WebRequest -Uri "https://the.earth.li/~sgtatham/putty/latest/w64/psftp.exe" -OutFile "$env:TEMP\psftp.exe" | |
- name: Upload Daily to shokoanime.com via SFTP | |
shell: pwsh | |
env: | |
FTP_USERNAME: ${{ secrets.FTP_USERNAME }} | |
FTP_PASSWORD: ${{ secrets.FTP_PASSWORD }} | |
FTP_SERVER: ${{ secrets.FTP_SERVER }} | |
run: | | |
# Create an SFTP command script to upload the file | |
$sftp_script = @" | |
lcd $PWD | |
put .\\ShokoDesktop.zip /files/shoko-desktop/daily/ShokoDesktop.zip | |
quit | |
"@ | |
# Write the script to a temporary file | |
$sftp_script_path = "$env:TEMP\sftp_script.txt" | |
$sftp_script | Out-File -FilePath $sftp_script_path | |
# Use PSFTP to upload the file via SFTP with host key checking disabled | |
& "$env:TEMP\psftp.exe" -batch -o StrictHostKeyChecking=no -pw $env:FTP_PASSWORD $env:FTP_USERNAME@$env:FTP_SERVER -b $sftp_script_path | |
# Cleanup the temporary script file | |
Remove-Item $sftp_script_path |