mirror of
https://github.com/nini22P/iris.git
synced 2026-05-31 16:39:20 +08:00
168 lines
5.9 KiB
YAML
168 lines
5.9 KiB
YAML
name: ci
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- dev
|
|
paths-ignore:
|
|
- README.md
|
|
- README_CN.md
|
|
- LICENSE
|
|
pull_request:
|
|
paths-ignore:
|
|
- README.md
|
|
- README_CN.md
|
|
- LICENSE
|
|
|
|
jobs:
|
|
build-windows:
|
|
runs-on: windows-2022
|
|
steps:
|
|
- name: Clone repository
|
|
uses: actions/checkout@v4
|
|
- name: Set up Flutter
|
|
uses: subosito/flutter-action@v2
|
|
with:
|
|
channel: stable
|
|
- name: Generate code
|
|
run: flutter pub get && flutter pub run build_runner build --delete-conflicting-outputs
|
|
- name: Build Flutter application for Windows
|
|
run: flutter build windows
|
|
- name: Create ZIP archive
|
|
run: |
|
|
# Create a directory to hold the files
|
|
mkdir IRIS
|
|
# Copy the build output to the IRIS directory
|
|
Copy-Item -Path "build\windows\x64\runner\Release\*" -Destination "IRIS" -Recurse -Force
|
|
# Create a ZIP file
|
|
Compress-Archive -Path "IRIS" -DestinationPath "IRIS-windows.zip"
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: IRIS-windows.zip
|
|
path: IRIS-windows.zip
|
|
- name: Remove updater
|
|
run: Remove-Item -Path build\windows\x64\runner\Release\iris-updater.bat -Force
|
|
- name: Create installer
|
|
run: iscc inno.iss
|
|
- name: Upload installer
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: IRIS-windows-installer.exe
|
|
path: build\windows\x64\runner\Release\IRIS-windows-installer.exe
|
|
- name: Clean up
|
|
run: Remove-Item -Path build\windows\x64\runner\Release\ -Recurse -Force
|
|
- name: Build store msix
|
|
run: dart run msix:build --store true
|
|
- name: Remove updater
|
|
run: Remove-Item -Path build\windows\x64\runner\Release\iris-updater.bat -Force
|
|
- name: Pack store msix
|
|
run: dart run msix:pack --store true --output-name IRIS-windows-store
|
|
- name: Upload msix
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: IRIS-windows-store.msix
|
|
path: build\windows\x64\runner\Release\IRIS-windows-store.msix
|
|
|
|
build-android:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Clone repository
|
|
uses: actions/checkout@v4
|
|
- name: Set up Flutter
|
|
uses: subosito/flutter-action@v2
|
|
with:
|
|
channel: stable
|
|
- name: Generate code
|
|
run: flutter pub get && flutter pub run build_runner build --delete-conflicting-outputs
|
|
- name: Set up Java
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
distribution: zulu
|
|
java-version: 21
|
|
- name: Decode and save keystore
|
|
run: |
|
|
echo "${{ secrets.KEYSTORE }}" | base64 --decode > android/app/keystore.jks
|
|
- name: Save key.properties
|
|
run: |
|
|
echo "storePassword=${{ secrets.STORE_PASSWORD }}" >> android/key.properties
|
|
echo "keyPassword=${{ secrets.KEY_PASSWORD }}" >> android/key.properties
|
|
echo "keyAlias=${{ secrets.KEY_ALIAS }}" >> android/key.properties
|
|
echo "storeFile=keystore.jks" >> android/key.properties
|
|
- name: Build Flutter application for Android
|
|
run: flutter build apk --split-per-abi
|
|
- name: Rename armeabi-v7a APK
|
|
run: mv build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk IRIS-android-armeabi-v7a.apk
|
|
- name: Rename arm64-v8a APK
|
|
run: mv build/app/outputs/flutter-apk/app-arm64-v8a-release.apk IRIS-android-arm64-v8a.apk
|
|
- name: Rename x86_64 APK
|
|
run: mv build/app/outputs/flutter-apk/app-x86_64-release.apk IRIS-android-x86_64.apk
|
|
- name: Upload armeabi-v7a APK
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: IRIS-android-armeabi-v7a.apk
|
|
path: IRIS-android-armeabi-v7a.apk
|
|
- name: Upload arm64-v8a APK
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: IRIS-android-arm64-v8a.apk
|
|
path: IRIS-android-arm64-v8a.apk
|
|
- name: Upload x86_64 APK
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: IRIS-android-x86_64.apk
|
|
path: IRIS-android-x86_64.apk
|
|
|
|
release:
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
runs-on: ubuntu-latest
|
|
needs:
|
|
- build-windows
|
|
- build-android
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
- name: Get version
|
|
id: yq
|
|
uses: mikefarah/yq@master
|
|
with:
|
|
cmd: yq '.version' 'pubspec.yaml'
|
|
- name: Print version
|
|
run: echo ${{ steps.yq.outputs.result }}
|
|
- name: Prepare tag name
|
|
id: tag_name
|
|
run: |
|
|
VERSION="${{ steps.yq.outputs.result }}"
|
|
TAG_NAME="v${VERSION%%+*}"
|
|
echo "TAG_NAME=$TAG_NAME" >> "$GITHUB_OUTPUT"
|
|
- name: Check tag
|
|
uses: mukunku/tag-exists-action@v1.6.0
|
|
id: check-tag
|
|
with:
|
|
tag: ${{ steps.tag_name.outputs.TAG_NAME }}
|
|
- name: Eextract log
|
|
if: steps.check-tag.outputs.exists == 'false'
|
|
run: python extract_log.py ${{ steps.tag_name.outputs.TAG_NAME }}
|
|
- name: Download artifact
|
|
if: steps.check-tag.outputs.exists == 'false'
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
path: artifacts
|
|
merge-multiple: true
|
|
- name: Release
|
|
if: steps.check-tag.outputs.exists == 'false'
|
|
uses: softprops/action-gh-release@v2
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
tag_name: ${{ steps.tag_name.outputs.TAG_NAME }}
|
|
body_path: CHANGELOG_${{ steps.tag_name.outputs.TAG_NAME }}.md
|
|
draft: false
|
|
prerelease: false
|
|
files: |
|
|
artifacts/IRIS-windows.zip
|
|
artifacts/IRIS-windows-installer.exe
|
|
artifacts/IRIS-android-armeabi-v7a.apk
|
|
artifacts/IRIS-android-arm64-v8a.apk
|
|
artifacts/IRIS-android-x86_64.apk
|