Skip to content

Commit

Permalink
add android and ios build to github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
sun-jiao committed Feb 28, 2024
1 parent df28e88 commit a5a819c
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 9 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,25 @@ jobs:
with:
name: Renamer-${{github.ref_name}}-${{ steps.vars.outputs.sha_short }}-appimage
path: Renamer-x86_64.AppImage
- uses: actions/setup-java@v1
with:
java-version: '12.x'
- name: decode key base64
run: echo $KEYSTORE_BASE64 | base64 -di > ~/renamer.jks
env:
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}
- run: flutter build apk --release
env:
KEYSTORE_FILE: "~/renamer.jks"
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD}}
- name: Android Release
uses: actions/upload-artifact@v1
with:
name: renamer-${{github.ref_name}}-${{ steps.vars.outputs.sha_short }}-release-apk
path: build/app/outputs/apk/release/app-release.apk


build-and-release-windows:
runs-on: windows-latest
Expand Down Expand Up @@ -104,4 +123,14 @@ jobs:
with:
name: renamer-${{github.ref_name}}-${{ steps.vars.outputs.sha_short }}-macos
path: build/macos/Build/Products/Release/renamer.dmg
- name: Build ios
run: |
flutter build ios --release --no-codesign
ln -sf ./build/ios/iphoneos Payload
zip -r9 renamer-${{github.ref_name}}-${{ steps.vars.outputs.sha_short }}-release.ipa Payload/runner.app
- name: ios Release
uses: actions/upload-artifact@v4
with:
name: renamer-${{github.ref_name}}-${{ steps.vars.outputs.sha_short }}-ios
path: renamer-${{github.ref_name}}-${{ steps.vars.outputs.sha_short }}-release.ipa

26 changes: 17 additions & 9 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,15 @@ if (flutterVersionName == null) {

def keystorePropertiesFile = rootProject.file("key.properties")
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

def _storeFile = file(System.getenv("KEYSTORE") ?: keystoreProperties["storeFile"])
def _storePassword = System.getenv("KEYSTORE_PASSWORD") ?: keystoreProperties["storePassword"]
def _keyAlias = System.getenv("KEY_ALIAS") ?: keystoreProperties["keyAlias"]
def _keyPassword = System.getenv("KEY_PASSWORD") ?: keystoreProperties["keyPassword"]


android {
namespace "net.sunjiao.renamer"
Expand Down Expand Up @@ -57,17 +65,17 @@ android {

signingConfigs {
debug {
keyAlias keystoreProperties['keyAlias'] //别名
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile']) //签名文件路径
storePassword keystoreProperties['storePassword']
keyAlias _keyAlias
keyPassword _keyPassword
storeFile _storeFile
storePassword _storePassword
}

release {
keyAlias keystoreProperties['keyAlias'] //别名
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile']) //签名文件路径
storePassword keystoreProperties['storePassword']
keyAlias _keyAlias
keyPassword _keyPassword
storeFile _storeFile
storePassword _storePassword
}
}

Expand Down

0 comments on commit a5a819c

Please sign in to comment.