fixing old artifact #23
Workflow file for this run
This file contains hidden or 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 and Release Windows Installer | |
on: | |
push: | |
tags: | |
- 'v*' | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: 'Tag to build and release (e.g., v1.0.0) [leave blank for dev build only]' | |
required: false | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.inputs.tag || github.ref_name || 'main' }} | |
# Install Haxe | |
- name: Install Haxe | |
uses: krdlab/setup-haxe@v1 | |
with: | |
haxe-version: 4.3.3 | |
# Install dependencies | |
- name: Install haxelibs | |
run: | | |
haxelib install hxcpp | |
haxelib install openfl | |
haxelib install flixel | |
haxelib install openfl-aseprite | |
haxelib install hxcodec | |
# Sync version from Project.xml to STLGameLauncher.iss | |
- name: Sync version to .iss | |
run: python scripts/update_iss_version.py Project.xml STLGameLauncher.iss | |
# Build Windows executable | |
- name: Build Windows Executable | |
run: haxelib run lime build windows -release -final | |
# Install Inno Setup | |
- name: Install Inno Setup | |
run: choco install innosetup | |
# Build installer | |
- name: Build Installer | |
run: ISCC.exe STLGameLauncher.iss | |
# Find the installer exe | |
- name: Find installer | |
id: find_installer | |
run: | | |
$file = Get-ChildItem -Path Builds -Filter *.exe | Sort-Object LastWriteTime -Descending | Select-Object -First 1 | |
echo "INSTALLER_PATH=$($file.FullName)" | Out-File -FilePath $env:GITHUB_ENV -Append | |
# Upload as artifact if not a release build | |
- name: Upload Installer Artifact | |
if: ${{ !github.event.inputs.tag && !startsWith(github.ref, 'refs/tags/') }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: STLGameLauncher-Setup | |
path: ${{ env.INSTALLER_PATH }} | |
# Upload to GitHub Releases (only if running on a tag) | |
- name: Upload Release Asset | |
if: ${{ github.event.inputs.tag || startsWith(github.ref, 'refs/tags/') }} | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: ${{ env.INSTALLER_PATH }} | |
tag_name: ${{ github.event.inputs.tag || github.ref_name }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# Download WinSCP Portable (only for release builds) | |
- name: Download WinSCP Portable | |
if: ${{ github.event.inputs.tag || startsWith(github.ref, 'refs/tags/') }} | |
run: | | |
Invoke-WebRequest -Uri "https://winscp.net/download/WinSCP-6.3.3-Portable.zip" -OutFile "WinSCP.zip" | |
Expand-Archive WinSCP.zip -DestinationPath WinSCP | |
# Prepare WinSCP Script (only for release builds) | |
- name: Prepare WinSCP Script | |
if: ${{ github.event.inputs.tag || startsWith(github.ref, 'refs/tags/') }} | |
run: | | |
$script = @" | |
option batch abort | |
option confirm off | |
open sftp://${{ secrets.SFTP_USER }}:${{ secrets.SFTP_PASSWORD }}@${{ secrets.SFTP_HOST }} | |
rm /home/public/STLGameLauncher-Setup-*.exe | |
put \"${{ env.INSTALLER_PATH }}\" /home/public/ | |
exit | |
"@ | |
$script | Set-Content -Path deploy_script.txt | |
# Deploy installer with WinSCP (only for release builds) | |
- name: Deploy installer with WinSCP | |
if: ${{ github.event.inputs.tag || startsWith(github.ref, 'refs/tags/') }} | |
run: | | |
.\WinSCP\WinSCP.com /script=deploy_script.txt |