Publisher/.forgejo/workflows/Installer_Windows-AMD64-Nightly.yaml

146 lines
5.4 KiB
YAML
Raw Normal View History

2025-02-12 18:02:16 +00:00
name: Build Installer for Windows/AMD64/Nightly
on:
schedule:
- cron: "0 0 * * *"
2025-02-12 18:02:16 +00:00
jobs:
build-windows:
runs-on: win-10
steps:
2025-02-18 13:54:56 +00:00
- name: Check rsrc tool
shell: bash
run: |
2025-02-18 13:54:56 +00:00
rsrc --version || echo "rsrc tool not available"
2025-02-18 13:54:56 +00:00
- name: Check windres availability
shell: bash
run: |
2025-02-18 13:54:56 +00:00
windres --version || echo "windres not available, please install mingw"
2025-02-18 13:54:56 +00:00
- name: Check ImageMagick version
shell: powershell
2025-02-12 18:02:16 +00:00
run: |
2025-02-18 13:54:56 +00:00
magick -version
2025-02-12 18:02:16 +00:00
2025-02-18 13:54:56 +00:00
- name: Clone Publisher repo and Generate Manifest Files
shell: bash
run: |
2025-02-18 13:54:56 +00:00
git clone https://weforge.xyz/Spitfire/Publisher.git
cd Publisher
# Run win_manifest_gen.go from the Publisher repo to generate manifest files.
go run win_manifest_gen.go \
--name "Spitfire Installer" \
--company "Spitfire Browser" \
--description "Official Installer for Spitfire Browser" \
--official "https://spitfirebrowser.xyz" \
--dev "https://weforge.xyz" \
--requireAdmin=false
2025-02-18 13:54:56 +00:00
# Copy generated files (app.manifest and app.rc) to the workspace root.
cp app.manifest ../
2025-02-18 13:54:56 +00:00
cp app.rc ../
cd ..
- name: Clone Installer, Convert Icon, and Build Spitfire Installer
2025-02-12 18:02:16 +00:00
shell: bash
run: |
set -e
2025-02-12 18:02:16 +00:00
git clone https://weforge.xyz/Spitfire/Installer.git
cd Installer
2025-02-18 13:54:56 +00:00
# Copy the generated manifest files from the workspace root.
cp ../app.manifest .
2025-02-18 13:54:56 +00:00
cp ../app.rc .
# Download the icon PNG (530x530) from the dynamic URL.
2025-02-18 13:54:56 +00:00
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
2025-02-18 13:54:56 +00:00
# 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
# Move the built executable one level up for packaging.
2025-02-12 18:02:16 +00:00
mv spitfire-installer.exe ..
2025-02-18 13:54:56 +00:00
cd ..
2025-02-12 18:02:16 +00:00
- name: Setup SSH Key for SourceForge
shell: bash
env:
SF_SSH_KEY: ${{ secrets.SF_SSH_KEY }}
run: |
echo "$SF_SSH_KEY" | sed 's/\\n/\n/g' | tr -d '\r' > sf_key
chmod 600 sf_key
2025-02-18 13:54:56 +00:00
2025-02-12 18:02:16 +00:00
- name: Download existing APPINDEX
shell: bash
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
2025-02-18 13:54:56 +00:00
2025-02-12 18:02:16 +00:00
- name: Compress artifact
shell: bash
run: |
tar -czf spitfire-installer-amd64-nightly-windows.tar.gz spitfire-installer.exe
ls -l
2025-02-18 13:54:56 +00:00
2025-02-12 18:02:16 +00:00
- name: Prepare installer folder structure and move artifact
shell: bash
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/
echo "$DATE" > date.txt
2025-02-18 13:54:56 +00:00
2025-02-12 18:02:16 +00:00
- name: Upload installer artifact to SourceForge
shell: bash
env:
SF_USER: ${{ secrets.SF_USER }}
run: |
DATE=$(cat date.txt)
scp -r -i sf_key -o IdentitiesOnly=yes upload/installer "$SF_USER@frs.sourceforge.net:/home/frs/project/spitfire-browser/"
2025-02-18 13:54:56 +00:00
2025-02-12 18:02:16 +00:00
- name: Update APPINDEX
shell: bash
run: |
DATE=$(cat date.txt)
cd Publisher
cp ../APPINDEX . || true
go run update_appindex.go \
--name "spitfire-installer" \
--release "nightly" \
--version "$DATE" \
--arch "amd64" \
--description "Nightly build" \
--url "https://spitfirebrowser.xyz/" \
--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 ../
2025-02-18 13:54:56 +00:00
2025-02-12 18:02:16 +00:00
- name: Upload updated APPINDEX
shell: bash
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"
2025-02-18 13:54:56 +00:00
2025-02-12 18:02:16 +00:00
- name: Cleanup SSH Key
if: always()
shell: bash
run: |
2025-02-18 13:54:56 +00:00
rm -f sf_key