feat: v1.0.16 — 词根词缀分析,联想记忆升级,设置页简化 #26
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 APK | |
| on: | |
| push: | |
| tags: | |
| - 'v*' # trigger on version tags like v1.0.5 | |
| workflow_dispatch: # allow manual trigger from GitHub UI | |
| inputs: | |
| tag_name: | |
| description: 'Tag name for the release (e.g. v1.0.5)' | |
| required: false | |
| default: '' | |
| permissions: | |
| contents: write # needed to create GitHub Releases and upload assets | |
| jobs: | |
| build: | |
| 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 Android SDK | |
| uses: android-actions/setup-android@v3 | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x gradlew | |
| - name: Build signed release APK | |
| env: | |
| KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }} | |
| KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} | |
| KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }} | |
| run: ./gradlew assembleRelease --no-daemon | |
| - name: Rename APK | |
| run: | | |
| VERSION=$(grep versionName app/build.gradle.kts | grep -o '"[^"]*"' | tr -d '"') | |
| mv app/build/outputs/apk/release/app-release.apk \ | |
| app/build/outputs/apk/release/IndoLearn-v${VERSION}.apk | |
| echo "APK_PATH=app/build/outputs/apk/release/IndoLearn-v${VERSION}.apk" >> $GITHUB_ENV | |
| echo "VERSION=v${VERSION}" >> $GITHUB_ENV | |
| - name: Upload APK artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: IndoLearn-release | |
| path: ${{ env.APK_PATH }} | |
| retention-days: 30 | |
| - name: Create GitHub Release | |
| if: startsWith(github.ref, 'refs/tags/') || (github.event_name == 'workflow_dispatch' && inputs.tag_name != '') | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: ${{ env.APK_PATH }} | |
| tag_name: ${{ inputs.tag_name || github.ref_name }} | |
| name: "IndoLearn ${{ inputs.tag_name || env.VERSION }}" | |
| body: | | |
| ## 更新内容 | |
| 见 version.json changelog 字段。 | |
| deploy-cloudflare: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/') | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Deploy Cloudflare Worker (after APK is live) | |
| env: | |
| CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| run: | | |
| npm install -g wrangler | |
| cd cloudflare | |
| wrangler deploy |