diff --git a/.forgejo/workflows/Installer_Windows-AMD64-Nightly.yaml b/.forgejo/workflows/Installer_Windows-AMD64-Nightly.yaml index 3c43e89..d30ac27 100644 --- a/.forgejo/workflows/Installer_Windows-AMD64-Nightly.yaml +++ b/.forgejo/workflows/Installer_Windows-AMD64-Nightly.yaml @@ -6,39 +6,33 @@ on: - cron: "0 0 * * *" jobs: - build-windows: - runs-on: win-10 + build: + runs-on: alpine-1.20 steps: - - name: Check rsrc tool - shell: bash + - name: Setup Environment run: | - rsrc --version || echo "rsrc tool not available" + export LOCAL_BIN="$HOME/.local/bin" + mkdir -p "$LOCAL_BIN" + export PATH="$PATH:$LOCAL_BIN:$HOME/go/bin" - - name: Check windres availability - shell: bash + - name: Verify Tools run: | - windres --version || echo "windres not available, please install mingw" + command -v go || { echo "::error::Go not found"; exit 1; } + command -v git || { echo "::error::Git not found"; exit 1; } + command -v curl || { echo "::error::Curl not found"; exit 1; } + command -v x86_64-w64-mingw32-windres || { echo "::error::Mingw-w64 not found"; exit 1; } + command -v magick || { echo "::error::ImageMagick not found"; exit 1; } + [ -f "$HOME/go/bin/rsrc" ] || { echo "::error::rsrc not found"; exit 1; } - - name: Check ImageMagick version - shell: powershell - run: | - magick -version - - - name: Check mt.exe availability - shell: bash - run: | - if ! command -v mt.exe > /dev/null 2>&1; then - echo "mt.exe not available, please install the Windows SDK" - exit 1 - else - echo "mt.exe is available" - fi - - - name: Clone Publisher repo and Generate Manifest Files - shell: bash + - name: Clone Repositories run: | git clone https://weforge.xyz/Spitfire/Publisher.git + git clone https://weforge.xyz/Spitfire/Installer.git + + - name: Generate Manifest Files + shell: bash + run: | cd Publisher # Run win_manifest_gen.go from the Publisher repo to generate manifest files. go run win_manifest_gen.go \ @@ -49,69 +43,51 @@ jobs: --dev "https://weforge.xyz" \ --requireAdmin=true # Copy generated files (app.manifest and app.rc) to the workspace root. - cp app.manifest ../ - cp app.rc ../ + cp app.manifest ../Installer/ + cp app.rc ../Installer/ cd .. - - name: Clone Installer, Convert Icon, and Build Spitfire Installer - shell: bash + - name: Build Windows Installer + working-directory: ./Installer run: | - set -e - git clone https://weforge.xyz/Spitfire/Installer.git - cd Installer - # Copy the generated manifest files from the workspace root. - cp ../app.manifest . - cp ../app.rc . - # Download the icon PNG (530x530) from the dynamic URL. curl -fL "https://weforge.xyz/Spitfire/Branding/raw/branch/main/active/browser/icon.png" -o icon.png - ls -l icon.png - head -n 10 icon.png || true - # Convert the PNG to a Windows ICO file with multiple sizes using ImageMagick. magick icon.png -define icon:auto-resize=256,128,64,48,32,16 icon.ico - # Prepend an ICON directive to app.rc so the icon is embedded. - echo '1 ICON "icon.ico"' | cat - app.rc > tmp.rc && mv tmp.rc app.rc - # Compile the resource script into a .syso file using windres. - windres app.rc -O coff -o resource.syso - # Build the installer; resource.syso is automatically linked. - CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc GOOS=windows GOARCH=amd64 \ - go build -ldflags "-s -w" -o spitfire-installer.exe - # Enforce manifest using mt.exe - mt.exe -manifest app.manifest -outputresource:spitfire-installer.exe\;#1 - # Move the built executable one level up for packaging. - mv spitfire-installer.exe .. - cd .. + echo '1 ICON "icon.ico"' >> app.rc + x86_64-w64-mingw32-windres app.rc -O coff -o app.syso + $HOME/go/bin/rsrc -manifest app.manifest -o rsrc.syso + + # Verify syso files exist + ls -la *.syso - - name: Setup SSH Key for SourceForge - shell: bash + CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc GOOS=windows GOARCH=amd64 \ + go build -ldflags "-s -w -H=windowsgui" -o spitfire-installer.exe + + # Verify executable metadata + exiftool spitfire-installer.exe + + upx --best spitfire-installer.exe + + - name: Setup SSH Key env: SF_SSH_KEY: ${{ secrets.SF_SSH_KEY }} run: | echo "${SF_SSH_KEY}" > sf_key chmod 600 sf_key - - name: Download existing APPINDEX - shell: bash + - name: Download APPINDEX env: SF_USER: ${{ secrets.SF_USER }} run: | - scp -i sf_key -o IdentitiesOnly=yes "$SF_USER@frs.sourceforge.net:/home/frs/project/spitfire-browser/APPINDEX" APPINDEX || true + scp -i sf_key -vvv -o IdentitiesOnly=yes "$SF_USER@frs.sourceforge.net:/home/frs/project/spitfire-browser/APPINDEX" APPINDEX || true - - name: Compress artifact - shell: bash - run: | - tar -czf spitfire-installer-amd64-nightly-windows.tar.gz spitfire-installer.exe - ls -l - - - name: Prepare installer folder structure and move artifact - shell: bash + - name: Prepare Artifact run: | DATE=$(date +'%Y.%m.%d') mkdir -p upload/installer/amd64/nightly/$DATE - mv spitfire-installer-amd64-nightly-windows.tar.gz upload/installer/amd64/nightly/$DATE/ + tar -czf upload/installer/amd64/nightly/$DATE/spitfire-installer-amd64-nightly-windows.tar.gz -C Installer spitfire-installer.exe echo "$DATE" > date.txt - - name: Upload installer artifact to SourceForge - shell: bash + - name: Upload Artifact env: SF_USER: ${{ secrets.SF_USER }} run: | @@ -119,7 +95,6 @@ jobs: scp -r -i sf_key -o IdentitiesOnly=yes upload/installer "$SF_USER@frs.sourceforge.net:/home/frs/project/spitfire-browser/" - name: Update APPINDEX - shell: bash run: | DATE=$(cat date.txt) cd Publisher @@ -134,26 +109,20 @@ jobs: --license "AGPL-3.0" \ --origin "installer" \ --maintainer "Internet Addict" \ - --dependencies "" \ --platform "windows" \ --icon "https://weforge.xyz/Spitfire/Branding/raw/branch/main/active/browser/icon.svg" \ - --screenshots "https://spitfirebrowser.xyz/static/images/screenshots/1.png" \ - --tags "browser,experimental,testing" \ - --notes "Automated build of Spitfire" \ --remotePath "installer/amd64/nightly/$DATE/spitfire-installer-amd64-nightly-windows.tar.gz" \ --compressedFile "spitfire-installer-amd64-nightly-windows.tar.gz" \ --uncompressedFile "spitfire-installer.exe" cp APPINDEX ../ - - name: Upload updated APPINDEX - shell: bash + - name: Upload Updated APPINDEX env: SF_USER: ${{ secrets.SF_USER }} run: | scp -i sf_key -o IdentitiesOnly=yes APPINDEX "$SF_USER@frs.sourceforge.net:/home/frs/project/spitfire-browser/APPINDEX" - - name: Cleanup SSH Key + - name: Cleanup if: always() - shell: bash run: | - rm -f sf_key \ No newline at end of file + rm -rf sf_key upload APPINDEX date.txt \ No newline at end of file