Manual Build & Publish Release APK #265
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: Manual Build & Publish Release APK | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: '版本號' | |
| required: true | |
| type: string | |
| jobs: | |
| build-and-release: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup JDK | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '21' | |
| distribution: 'temurin' | |
| - name: Decode Release Keystore | |
| run: | | |
| echo "Decoding keystore from secrets..." | |
| echo "${{ secrets.RELEASE_KEYSTORE_BASE64 }}" | base64 --decode > release-key.jks | |
| echo "Keystore decoded successfully." | |
| - name: Make Gradle executable | |
| run: chmod +x ./gradlew | |
| - name: Set up Python 3.8 | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.8' | |
| - name: Clean project | |
| run: ./gradlew clean | |
| - name: Build Signed Release APK | |
| run: ./gradlew assembleRelease | |
| env: | |
| KEYSTORE_PATH: ${{ github.workspace }}/release-key.jks | |
| KEYSTORE_PASSWORD: ${{ secrets.RELEASE_KEYSTORE_PASSWORD }} | |
| KEY_ALIAS: ${{ secrets.RELEASE_KEY_ALIAS }} | |
| KEY_PASSWORD: ${{ secrets.RELEASE_KEY_PASSWORD }} | |
| APP_VERSION_NAME: ${{ github.event.inputs.tag }} | |
| - name: Create Release and Upload APK | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ github.event.inputs.tag }} | |
| files: app/build/outputs/apk/release/*.apk | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |