ci: fix keystore restore script (heredoc EOF indentation) #2
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build Release | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: 17 | |
| - name: Set up Gradle | |
| uses: gradle/actions/setup-gradle@v4 | |
| # 从仓库 Secrets 恢复签名。未配置时构建 unsigned APK(不阻塞) | |
| - name: Restore signing keystore from secrets | |
| env: | |
| KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }} | |
| KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} | |
| run: | | |
| if [ -n "$KEYSTORE_BASE64" ]; then | |
| mkdir -p keystore | |
| echo "$KEYSTORE_BASE64" | base64 -d > keystore/release.jks | |
| printf 'storeFile=keystore/release.jks\nstorePassword=%s\nkeyAlias=betterheybox\nkeyPassword=%s\n' \ | |
| "$KEYSTORE_PASSWORD" "$KEYSTORE_PASSWORD" > keystore.properties | |
| else | |
| echo "No KEYSTORE_BASE64 secret - building unsigned APK" | |
| fi | |
| - name: Build release APK | |
| run: ./gradlew assembleRelease | |
| - name: Upload APK artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: app-release | |
| path: app/build/outputs/apk/release/*.apk | |
| - name: Publish GitHub Release (on tag) | |
| if: startsWith(github.ref, 'refs/tags/') | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: app/build/outputs/apk/release/*.apk | |
| generate_release_notes: true |