Skip to content

fix package name

fix package name #32

Workflow file for this run

name: Flutter CI
env:
TZ: Asia/Taipei
SIGN_ON_PUSH: 'false'
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
workflow_dispatch:
inputs:
platform:
description: 'Which platform to build?'
required: true
default: 'both'
type: choice
options:
- android
- ios
- both
use_signing:
description: 'Attempt to code sign? (Requires secrets to be set)'
required: true
default: 'false'
type: choice
options:
- 'true'
- 'false'
jobs:
build-android:
name: Build Flutter (Android)
if: github.event_name != 'workflow_dispatch' || (inputs.platform == 'android' || inputs.platform == 'both')
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.24.x'
channel: 'stable'
cache: true
- name: Generate build timestamp
run: echo "BUILD_TIMESTAMP=$(date +'%Y%m%d-%H%M')" >> $GITHUB_ENV
- name: Install dependencies
run: flutter pub get
- name: Set Android Signing Flag
run: |
if [[ "${{ secrets.ANDROID_SIGNING_KEY_BASE64 }}" != "" && ( ("${{ github.event_name }}" == "workflow_dispatch" && "${{ inputs.use_signing }}" == "true") || ("${{ github.event_name }}" != "workflow_dispatch" && "${{ env.SIGN_ON_PUSH }}" == "true") ) ]]; then
echo "SHOULD_SIGN_ANDROID=true" >> $GITHUB_ENV
else
echo "SHOULD_SIGN_ANDROID=false" >> $GITHUB_ENV
fi
- name: Decode Android Keystore
if: env.SHOULD_SIGN_ANDROID == 'true'
run: |
echo "${{ secrets.ANDROID_SIGNING_KEY_BASE64 }}" | base64 --decode > android/app/upload-keystore.jks
- name: Create key.properties
if: env.SHOULD_SIGN_ANDROID == 'true'
run: |
echo "storeFile=upload-keystore.jks" > android/key.properties
echo "storePassword=${{ secrets.ANDROID_SIGNING_STORE_PASSWORD }}" >> android/key.properties
echo "keyAlias=${{ secrets.ANDROID_SIGNING_KEY_ALIAS }}" >> android/key.properties
echo "keyPassword=${{ secrets.ANDROID_SIGNING_KEY_PASSWORD }}" >> android/key.properties
- name: Build Android Appbundle
if: env.SHOULD_SIGN_ANDROID == 'true'
run: flutter build appbundle --release
- name: Deploy to Closed Beta
if: env.SHOULD_SIGN_ANDROID == 'true'
uses: r0adkll/upload-google-play@v1
with:
serviceAccountJsonPlainText: ${{ secrets.GOOGLE_PLAY_API_KEY_JSON }}
packageName: club.ntut.npc.tat2
releaseFiles: build/app/outputs/bundle/release/app-release.aab
track: internal
- name: Build Android APK
run: flutter build apk --debug
- name: Upload APK Artifact
uses: actions/upload-artifact@v4
with:
name: release-apk-${{ env.BUILD_TIMESTAMP }}
path: build/app/outputs/flutter-apk/app-debug.apk
- name: Create Pre-release and Upload Assets
uses: softprops/action-gh-release@v1
with:
tag_name: "pre-release-${{ github.sha }}"
name: "Pre-release ${{ github.sha }}"
body: "Automated pre-release for commit ${{ github.sha }}"
prerelease: true
files: |
build/app/outputs/flutter-apk/debug.apk
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
build-ios:
name: Build Flutter (iOS)
if: github.event_name != 'workflow_dispatch' || (inputs.platform == 'ios' || inputs.platform == 'both')
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.24.x'
channel: 'stable'
cache: true
- name: Generate build timestamp
run: echo "BUILD_TIMESTAMP=$(date +'%Y%m%d-%H%M')" >> $GITHUB_ENV
- name: Install dependencies
run: flutter pub get
- name: Set iOS Signing Flag
run: |
if [[ "${{ secrets.IOS_BUILD_CERTIFICATE_BASE64 }}" != "" && ( ("${{ github.event_name }}" == "workflow_dispatch" && "${{ inputs.use_signing }}" == "true") || ("${{ github.event_name }}" != "workflow_dispatch" && "${{ env.SIGN_ON_PUSH }}" == "true") ) ]]; then
echo "SHOULD_SIGN_IOS=true" >> $GITHUB_ENV
else
echo "SHOULD_SIGN_IOS=false" >> $GITHUB_ENV
fi
- name: Install Provisioning Profile
if: env.SHOULD_SIGN_IOS == 'true'
run: |
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
echo "${{ secrets.IOS_BUILD_PROVISION_PROFILE_BASE64 }}" | base64 --decode > ~/Library/MobileDevice/Provisioning\ Profiles/github_actions.mobileprovision
- name: Import Code Signing Certificate
if: env.SHOULD_SIGN_IOS == 'true'
uses: apple-actions/import-codesign-certs@v3
with:
p12-file-base64: ${{ secrets.IOS_BUILD_CERTIFICATE_BASE64 }}
p12-password: ${{ secrets.IOS_P12_PASSWORD }}
- name: Build iOS IPA (Signed)
if: env.SHOULD_SIGN_IOS == 'true'
env:
IOS_APPLE_TEAM_ID: ${{ secrets.IOS_APPLE_TEAM_ID }}
run: flutter build ipa --release --export-options-plist=ios/ExportOptions.plist
- name: Build iOS IPA (Unsigned)
if: env.SHOULD_SIGN_IOS == 'false'
run: flutter build ipa --debug --no-codesign
- name: Upload IPA Artifact
if: env.SHOULD_SIGN_IOS == 'true'
uses: actions/upload-artifact@v4
with:
name: release-ipa-${{ env.BUILD_TIMESTAMP }}
path: build/ios/ipa/*.ipa