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

This commit is contained in:
Internet Addict 2025-02-18 12:40:49 +00:00
parent bb697f77b9
commit 8c3142699c

View file

@ -14,80 +14,52 @@ jobs:
run: | run: |
go install github.com/akavel/rsrc@latest go install github.com/akavel/rsrc@latest
- name: Install ImageMagick (if not already installed)
shell: powershell
run: |
choco install imagemagick -y --no-progress
- name: Clone Publisher repo - name: Clone Publisher repo
shell: bash shell: bash
run: | run: |
git clone https://weforge.xyz/Spitfire/Publisher.git git clone https://weforge.xyz/Spitfire/Publisher.git
- name: Clone, generate manifest, convert icon, and Build Spitfire Installer - name: Clone Manifest Generator and Generate Manifest Files
shell: bash
run: |
git clone https://weforge.xyz/partisan/upload-test.git manifest-gen
cd manifest-gen
# Run the manifest generator with desired flags.
# Adjust the flag values as needed.
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
# Copy generated files to the workspace root.
cp app.manifest ../
cp versioninfo.json ../
- name: Clone Installer, Convert Icon, and Build Spitfire Installer
shell: bash shell: bash
run: | run: |
set -e set -e
git clone https://weforge.xyz/Spitfire/Installer.git git clone https://weforge.xyz/Spitfire/Installer.git
cd Installer cd Installer
# Copy the generated manifest files from the parent directory.
# Compute current date (e.g. 2025.02.11) cp ../app.manifest .
DATE=$(date +'%Y.%m.%d') cp ../versioninfo.json .
# Download the icon PNG (530x530) from the dynamic URL.
# Download the icon PNG (530x530) from the dynamic URL
curl -L "https://weforge.xyz/Spitfire/Branding/src/branch/main/active/browser/icon.png" -o icon.png curl -L "https://weforge.xyz/Spitfire/Branding/src/branch/main/active/browser/icon.png" -o icon.png
# Convert the PNG to a Windows ICO file with multiple sizes using ImageMagick. # Convert the PNG to a Windows ICO file with multiple sizes using ImageMagick.
# This command auto-resizes to common icon sizes: 256, 128, 64, 48, 32, and 16.
magick icon.png -define icon:auto-resize=256,128,64,48,32,16 icon.ico magick icon.png -define icon:auto-resize=256,128,64,48,32,16 icon.ico
# Create dynamic app.manifest with DATE as version (appending .0 to meet version format)
cat <<EOF > app.manifest
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
name="Spitfire Installer"
version="${DATE}.0"
processorArchitecture="*"
type="win32"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware>true/PM</dpiAware>
</windowsSettings>
</application>
</assembly>
EOF
# Create version info JSON with dynamic version and website URLs in Comments
cat <<EOF > versioninfo.json
{
"Version": {
"Major": 0,
"Minor": 0,
"Patch": 0,
"Build": 0
},
"CompanyName": "Spitfire Browser",
"FileDescription": "Official Installer for Spitfire Browser",
"FileVersion": "${DATE}.0",
"InternalName": "spitfire-installer",
"LegalCopyright": "Copyright © Spitfire Browser",
"OriginalFilename": "spitfire-installer.exe",
"ProductName": "Spitfire Browser",
"ProductVersion": "${DATE}.0",
"Comments": "Official website: https://spitfirebrowser.xyz; Source/Dev website: https://weforge.xyz"
}
EOF
# Generate the resource file embedding manifest, version info, and the icon. # Generate the resource file embedding manifest, version info, and the icon.
rsrc -manifest app.manifest -json versioninfo.json -ico icon.ico -o rsrc.syso rsrc -manifest app.manifest -json versioninfo.json -ico icon.ico -o rsrc.syso
# Build the installer; rsrc.syso is automatically linked by the Go compiler. # Build the installer; rsrc.syso is automatically linked by the Go compiler.
CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc GOOS=windows GOARCH=amd64 go build -ldflags "-s -w" -o spitfire-installer.exe 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.
# Move the built executable one level up for further packaging.
mv spitfire-installer.exe .. mv spitfire-installer.exe ..
- name: Setup SSH Key for SourceForge - name: Setup SSH Key for SourceForge
@ -103,9 +75,7 @@ EOF
env: env:
SF_USER: ${{ secrets.SF_USER }} SF_USER: ${{ secrets.SF_USER }}
run: | run: |
scp -i sf_key -o IdentitiesOnly=yes \ scp -i sf_key -o IdentitiesOnly=yes "$SF_USER@frs.sourceforge.net:/home/frs/project/spitfire-browser/APPINDEX" APPINDEX || true
"$SF_USER@frs.sourceforge.net:/home/frs/project/spitfire-browser/APPINDEX" \
APPINDEX || true
- name: Compress artifact - name: Compress artifact
shell: bash shell: bash
@ -116,12 +86,9 @@ EOF
- name: Prepare installer folder structure and move artifact - name: Prepare installer folder structure and move artifact
shell: bash shell: bash
run: | run: |
# Compute current date (e.g. 2025.02.11)
DATE=$(date +'%Y.%m.%d') DATE=$(date +'%Y.%m.%d')
# Create a separate packaging folder "upload" to avoid conflicts with the cloned repo folder.
mkdir -p upload/installer/amd64/nightly/$DATE mkdir -p upload/installer/amd64/nightly/$DATE
mv spitfire-installer-amd64-nightly-windows.tar.gz upload/installer/amd64/nightly/$DATE/ mv spitfire-installer-amd64-nightly-windows.tar.gz upload/installer/amd64/nightly/$DATE/
# Save the date for later steps.
echo "$DATE" > date.txt echo "$DATE" > date.txt
- name: Upload installer artifact to SourceForge - name: Upload installer artifact to SourceForge
@ -129,9 +96,7 @@ EOF
env: env:
SF_USER: ${{ secrets.SF_USER }} SF_USER: ${{ secrets.SF_USER }}
run: | run: |
# Read the date from file (if needed later)
DATE=$(cat date.txt) DATE=$(cat date.txt)
# Upload the entire packaging folder recursively.
scp -r -i sf_key -o IdentitiesOnly=yes upload/installer "$SF_USER@frs.sourceforge.net:/home/frs/project/spitfire-browser/" scp -r -i sf_key -o IdentitiesOnly=yes upload/installer "$SF_USER@frs.sourceforge.net:/home/frs/project/spitfire-browser/"
- name: Update APPINDEX - name: Update APPINDEX