add windows build
Some checks failed
Release / meta (push) Successful in 18s
Release / windows-build (push) Has been cancelled
Release / release-dev (push) Has been cancelled
Release / release-master (push) Has been cancelled
Release / linux-build (push) Has been cancelled
Release / android-build (push) Has been cancelled

This commit is contained in:
2025-12-30 12:12:17 +00:00
parent 8cf43c76e2
commit 9b307ab56b
2 changed files with 125 additions and 2 deletions

View File

@@ -10,7 +10,7 @@ env:
JAVA_VERSION: "17" JAVA_VERSION: "17"
ANDROID_SDK_ROOT: "${{ github.workspace }}/android-sdk" ANDROID_SDK_ROOT: "${{ github.workspace }}/android-sdk"
FLUTTER_VERSION: "3.38.5" FLUTTER_VERSION: "3.38.5"
BUILD_WINDOWS: "false" # set to "true" when you actually want Windows builds BUILD_WINDOWS: "true"
GITEA_BASE_URL: https://git.tgj.services GITEA_BASE_URL: https://git.tgj.services
jobs: jobs:
@@ -238,6 +238,58 @@ jobs:
name: linux-bundle name: linux-bundle
path: app-linux-x64.tar.gz path: app-linux-x64.tar.gz
windows-build:
runs-on:
- mileograph
needs: meta
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Flutter SDK (Windows)
shell: pwsh
run: |
$ErrorActionPreference = "Stop"
$flutterHome = "$env:USERPROFILE\flutter"
if (-Not (Test-Path "$flutterHome\bin\flutter.bat")) {
if (Test-Path $flutterHome) { Remove-Item -Recurse -Force $flutterHome }
$flutterZip = "$env:TEMP\flutter_windows_${env:FLUTTER_VERSION}-stable.zip"
Invoke-WebRequest -Uri "https://storage.googleapis.com/flutter_infra_release/releases/stable/windows/flutter_windows_${env:FLUTTER_VERSION}-stable.zip" -OutFile $flutterZip
Expand-Archive -Path $flutterZip -DestinationPath $env:USERPROFILE -Force
}
"$flutterHome\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
& "$flutterHome\bin\flutter.bat" --version
- name: Allow all git directories (CI)
run: git config --global --add safe.directory '*'
- name: Set pub cache path
shell: pwsh
run: |
"PUB_CACHE=$env:GITHUB_WORKSPACE\.pub-cache" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Enable Windows desktop
run: flutter config --enable-windows-desktop
- name: Flutter dependencies
run: flutter pub get
- name: Build Windows binary (release)
env:
BASE_VERSION: ${{ needs.meta.outputs.base_version }}
shell: pwsh
run: |
$ErrorActionPreference = "Stop"
flutter build windows --release
$zipName = "mileograph-windows-$env:BASE_VERSION.zip"
Compress-Archive -Path "build/windows/x64/runner/Release/*" -DestinationPath $zipName -Force
- name: Upload Windows artifact
uses: actions/upload-artifact@v3
with:
name: windows-bundle
path: mileograph-windows-${{ needs.meta.outputs.base_version }}.zip
release-dev: release-dev:
runs-on: runs-on:
- mileograph - mileograph
@@ -245,6 +297,7 @@ jobs:
- meta - meta
- android-build - android-build
- linux-build - linux-build
- windows-build
steps: steps:
- name: Install jq - name: Install jq
run: | run: |
@@ -262,6 +315,13 @@ jobs:
name: android-apk name: android-apk
path: artifacts path: artifacts
- name: Download Windows bundle
if: ${{ github.ref == 'refs/heads/dev' }}
uses: actions/download-artifact@v3
with:
name: windows-bundle
path: artifacts
- name: Prepare APK and tag - name: Prepare APK and tag
if: ${{ github.ref == 'refs/heads/dev' }} if: ${{ github.ref == 'refs/heads/dev' }}
id: bundle id: bundle
@@ -270,9 +330,11 @@ jobs:
TAG="${{ needs.meta.outputs.release_tag }}" TAG="${{ needs.meta.outputs.release_tag }}"
mv "artifacts/mileograph-${BASE}.apk" "artifacts/mileograph-${BASE}-dev.apk" mv "artifacts/mileograph-${BASE}.apk" "artifacts/mileograph-${BASE}-dev.apk"
mv "artifacts/mileograph-windows-${BASE}.zip" "artifacts/mileograph-windows-${BASE}-dev.zip"
echo "tag=${TAG}" >> "$GITHUB_OUTPUT" echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
echo "apk=artifacts/mileograph-${BASE}-dev.apk" >> "$GITHUB_OUTPUT" echo "apk=artifacts/mileograph-${BASE}-dev.apk" >> "$GITHUB_OUTPUT"
echo "windows_zip=artifacts/mileograph-windows-${BASE}-dev.zip" >> "$GITHUB_OUTPUT"
- name: Create prerelease on Gitea - name: Create prerelease on Gitea
if: ${{ github.ref == 'refs/heads/dev' }} if: ${{ github.ref == 'refs/heads/dev' }}
@@ -313,6 +375,32 @@ jobs:
"${GITEA_BASE_URL}/api/v1/repos/${{ github.repository }}/releases/${RELEASE_ID}/assets" \ "${GITEA_BASE_URL}/api/v1/repos/${{ github.repository }}/releases/${RELEASE_ID}/assets" \
>/dev/null >/dev/null
- name: Attach Windows bundle to Gitea release
if: ${{ github.ref == 'refs/heads/dev' }}
run: |
set -euo pipefail
TAG="${{ steps.bundle.outputs.tag }}"
ZIP="${{ steps.bundle.outputs.windows_zip }}"
RELEASE_JSON=$(curl -sS \
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
"${GITEA_BASE_URL}/api/v1/repos/${{ github.repository }}/releases/tags/${TAG}")
RELEASE_ID=$(echo "$RELEASE_JSON" | jq -r '.id')
echo "Release ID: $RELEASE_ID"
NAME=$(basename "$ZIP")
echo "Uploading $NAME"
curl -sS -X POST \
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
-F "attachment=@${ZIP}" \
-F "name=${NAME}" \
"${GITEA_BASE_URL}/api/v1/repos/${{ github.repository }}/releases/${RELEASE_ID}/assets" \
>/dev/null
release-master: release-master:
runs-on: runs-on:
- mileograph - mileograph
@@ -320,6 +408,7 @@ jobs:
- meta - meta
- android-build - android-build
- linux-build - linux-build
- windows-build
steps: steps:
- name: Install jq - name: Install jq
run: | run: |
@@ -337,6 +426,13 @@ jobs:
name: android-apk name: android-apk
path: artifacts path: artifacts
- name: Download Windows bundle
if: ${{ github.ref == 'refs/heads/master' }}
uses: actions/download-artifact@v3
with:
name: windows-bundle
path: artifacts
- name: Prepare APK and tag - name: Prepare APK and tag
if: ${{ github.ref == 'refs/heads/master' }} if: ${{ github.ref == 'refs/heads/master' }}
id: bundle id: bundle
@@ -346,6 +442,7 @@ jobs:
echo "tag=${TAG}" >> "$GITHUB_OUTPUT" echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
echo "apk=artifacts/mileograph-${BASE}.apk" >> "$GITHUB_OUTPUT" echo "apk=artifacts/mileograph-${BASE}.apk" >> "$GITHUB_OUTPUT"
echo "windows_zip=artifacts/mileograph-windows-${BASE}.zip" >> "$GITHUB_OUTPUT"
- name: Create release on Gitea - name: Create release on Gitea
if: ${{ github.ref == 'refs/heads/master' }} if: ${{ github.ref == 'refs/heads/master' }}
@@ -384,3 +481,29 @@ jobs:
-F "name=${NAME}" \ -F "name=${NAME}" \
"${GITEA_BASE_URL}/api/v1/repos/${{ github.repository }}/releases/${RELEASE_ID}/assets" \ "${GITEA_BASE_URL}/api/v1/repos/${{ github.repository }}/releases/${RELEASE_ID}/assets" \
>/dev/null >/dev/null
- name: Attach Windows bundle to Gitea release
if: ${{ github.ref == 'refs/heads/master' }}
run: |
set -euo pipefail
TAG="${{ steps.bundle.outputs.tag }}"
ZIP="${{ steps.bundle.outputs.windows_zip }}"
RELEASE_JSON=$(curl -sS \
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
"${GITEA_BASE_URL}/api/v1/repos/${{ github.repository }}/releases/tags/${TAG}")
RELEASE_ID=$(echo "$RELEASE_JSON" | jq -r '.id')
echo "Release ID: $RELEASE_ID"
NAME=$(basename "$ZIP")
echo "Uploading $NAME"
curl -sS -X POST \
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
-F "attachment=@${ZIP}" \
-F "name=${NAME}" \
"${GITEA_BASE_URL}/api/v1/repos/${{ github.repository }}/releases/${RELEASE_ID}/assets" \
>/dev/null

View File

@@ -16,7 +16,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts # In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix. # of the product and file versions while build-number is used as the build suffix.
version: 0.4.4+1 version: 0.4.5+1
environment: environment:
sdk: ^3.8.1 sdk: ^3.8.1