Skip to content

Commit

Permalink
[Fix] fix github action apk sign
Browse files Browse the repository at this point in the history
  • Loading branch information
canxin121 committed Jul 7, 2024
1 parent 9a93d50 commit 464c438
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 85 deletions.
45 changes: 22 additions & 23 deletions .github/workflows/main.yml → .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,28 @@ jobs:
with:
submodules: true

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.8'

- name: Set up signing files
run: |
$env:APK_SIGN_PWD="${{ secrets.APK_SIGN_PWD }}"
$env:APK_SIGN_ALIAS="${{ secrets.APK_SIGN_ALIAS }}"
$env:APK_SIGN_JKS="${{ secrets.APK_SIGN_JKS }}"
python tools/create_signing_files.py
shell: pwsh

- name: Print contents and length
run: |
Get-Content android\key.properties
$keyPropertiesLength = (Get-Content android\key.properties | Out-String).Length
echo "key.properties length: $keyPropertiesLength"
$keyJksLength = (Get-Item android\app\key.jks).length
echo "key.jks length: $keyJksLength"
shell: pwsh

- uses: subosito/flutter-action@v2
with:
channel: "stable"
Expand Down Expand Up @@ -208,29 +230,6 @@ jobs:
path: ./dist/${{ needs.get_version.outputs.app_version }}/AppRhyme-release-windows-x86_64-${{ needs.get_version.outputs.app_version }}-setup.exe
compression-level: 9

- name: Set up environment variables
run: |
$env:APK_SIGN_PWD="${{ secrets.APK_SIGN_PWD }}"
$env:APK_SIGN_ALIAS="${{ secrets.APK_SIGN_ALIAS }}"
$env:APK_SIGN_JKS="${{ secrets.APK_SIGN_JKS }}"
echo "APK_SIGN_PWD length: $($env:APK_SIGN_PWD.Length)"
echo "APK_SIGN_ALIAS length: $($env:APK_SIGN_ALIAS.Length)"
echo "APK_SIGN_JKS length: $($env:APK_SIGN_JKS.Length)"
shell: pwsh

- name: Write signing properties
run: |
echo keyPassword=$env:APK_SIGN_PWD > android\key.properties
echo storePassword=$env:APK_SIGN_PWD >> android\key.properties
echo keyAlias=$env:APK_SIGN_ALIAS >> android\key.properties
echo storeFile=key.jks >> android\key.properties
shell: pwsh

- name: Decode and save key
run: |
echo $env:APK_SIGN_JKS | base64 -d > android\app\key.jks
shell: pwsh

- name: Flutter build apk abi
run: flutter build apk --release --split-per-abi --verbose

Expand Down
44 changes: 23 additions & 21 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,28 @@ jobs:
uses: actions/checkout@v4
with:
submodules: true

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.8'

- name: Set up signing files
run: |
$env:APK_SIGN_PWD="${{ secrets.APK_SIGN_PWD }}"
$env:APK_SIGN_ALIAS="${{ secrets.APK_SIGN_ALIAS }}"
$env:APK_SIGN_JKS="${{ secrets.APK_SIGN_JKS }}"
python tools/create_signing_files.py
shell: pwsh

- name: Print contents and length
run: |
Get-Content android\key.properties
$keyPropertiesLength = (Get-Content android\key.properties | Out-String).Length
echo "key.properties length: $keyPropertiesLength"
$keyJksLength = (Get-Item android\app\key.jks).length
echo "key.jks length: $keyJksLength"
shell: pwsh

- uses: subosito/flutter-action@v2
with:
Expand All @@ -166,7 +188,7 @@ jobs:
- name: Install Flutter Dependency
run: flutter pub get

- name: Install Rusti
- name: Install Rust
uses: dtolnay/rust-toolchain@stable

- name: Install Cargo-Ndk
Expand Down Expand Up @@ -203,26 +225,6 @@ jobs:
tag_name: ${{ github.event.inputs.tag_name }}
token: ${{ secrets.RELEASE_TOKEN }}

- name: Set up environment variables
run: |
$env:APK_SIGN_PWD="${{ secrets.APK_SIGN_PWD }}"
$env:APK_SIGN_ALIAS="${{ secrets.APK_SIGN_ALIAS }}"
$env:APK_SIGN_JKS="${{ secrets.APK_SIGN_JKS }}"
shell: pwsh

- name: Write signing properties
run: |
echo keyPassword=$env:APK_SIGN_PWD > android\key.properties
echo storePassword=$env:APK_SIGN_PWD >> android\key.properties
echo keyAlias=$env:APK_SIGN_ALIAS >> android\key.properties
echo storeFile=key.jks >> android\key.properties
shell: pwsh

- name: Decode and save key
run: |
echo $env:APK_SIGN_JKS | base64 -d > android\app\key.jks
shell: pwsh

- name: Flutter build apk abi
run: flutter build apk --release --split-per-abi --verbose

Expand Down
41 changes: 0 additions & 41 deletions .github/workflows/test.yml

This file was deleted.

0 comments on commit 464c438

Please sign in to comment.