Skip to content

ci: update

ci: update #59

Workflow file for this run

name: Build
on:
push:
paths-ignore:
- README.md
- README_CN.md
- LICENSE
pull_request:
paths-ignore:
- README.md
- README_CN.md
- LICENSE
jobs:
build-windows:
name: Build Windows
runs-on: windows-latest
steps:
- name: Clone repository
uses: actions/checkout@v4
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
- name: Build Flutter application for Windows
run: flutter build windows
- name: Create ZIP archive
run: |
# Create a directory to hold the files
mkdir Iris
# Move the build output to the Iris directory
Move-Item -Path "build\windows\x64\runner\Release\*" -Destination "Iris" -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
path: Iris_windows.zip
build-android:
name: 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: 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
- name: Rename APK
run: mv build/app/outputs/flutter-apk/app-release.apk Iris_android.apk
- name: Upload Android artifact
uses: actions/upload-artifact@v4
with:
name: Iris_android
path: Iris_android.apk
release:
name: Release
if: ${{ 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 -r ".version | sub(\\"\\\\+.*\\"; \\"\\")" pubspec.yaml'

Check failure on line 87 in .github/workflows/ci.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/ci.yml

Invalid workflow file

You have an error in your yaml syntax on line 87
- name: Print version
run: echo ${{ steps.yq.outputs.result }}
- name: Download Windows artifact
uses: actions/download-artifact@v4
with:
name: Iris_windows
path: artifacts
- name: Download Android artifact
uses: actions/download-artifact@v4
with:
name: Iris_android
path: artifacts
- name: Create or Replace Tag
id: create_tag
run: |
TAG_NAME="v${{ steps.yq.outputs.result }}"
echo "TAG_NAME=$TAG_NAME" >> "$GITHUB_OUTPUT"
# Check if the tag exists
if git show-ref --quiet "refs/tags/$TAG_NAME"; then
echo "Tag $TAG_NAME already exists, deleting..."
if git tag -d "$TAG_NAME" && git push origin --delete "$TAG_NAME"; then
echo "Tag $TAG_NAME deleted."
else
echo "Failed to delete tag $TAG_NAME."
exit 1
fi
fi
echo "Creating new tag $TAG_NAME..."
git tag "$TAG_NAME"
git push origin "$TAG_NAME"
- name: Release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.create_tag.outputs.TAG_NAME }}
name: Iris ${{ steps.create_tag.outputs.TAG_NAME }}
body_path: CHANGELOG.md
draft: true
prerelease: false
files: |
artifacts/Iris_windows.zip
artifacts/Iris_android.apk