docs: add live total-downloads badge to README #8
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: release-please | |
| # Conventional-commit driven releases. | |
| # 1. release-please watches main, opens/maintains a "release PR" that bumps the version in | |
| # app/build.gradle.kts. Merging that PR tags the release and creates a DRAFT GitHub Release | |
| # (skip-changelog + draft in release-please-config.json). | |
| # 2. The publish job then builds the APK, has git-cliff render the notes + CHANGELOG.md, attaches | |
| # the APK, and flips the release to published. | |
| # git-cliff is the only changelog author; release-please only versions/tags/releases. | |
| on: | |
| push: | |
| branches: [main] | |
| permissions: | |
| contents: write | |
| issues: write | |
| pull-requests: write | |
| jobs: | |
| release-please: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| release_created: ${{ steps.rp.outputs.release_created }} | |
| tag_name: ${{ steps.rp.outputs.tag_name }} | |
| steps: | |
| - uses: googleapis/release-please-action@v4 | |
| id: rp | |
| with: | |
| config-file: release-please-config.json | |
| manifest-file: .release-please-manifest.json | |
| publish: | |
| needs: release-please | |
| if: ${{ needs.release-please.outputs.release_created == 'true' }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: main # stay on the branch so the CHANGELOG.md commit can be pushed | |
| fetch-depth: 0 # full history + tags for git-cliff | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: '17' | |
| cache: gradle | |
| - name: Decode signing keystore | |
| env: | |
| KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }} | |
| run: printf '%s' "$KEYSTORE_BASE64" | base64 -d > "$RUNNER_TEMP/release.jks" | |
| - name: Build signed release APK | |
| env: | |
| KEYSTORE_FILE: ${{ runner.temp }}/release.jks | |
| KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} | |
| KEY_ALIAS: ${{ secrets.KEY_ALIAS }} | |
| KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }} | |
| run: | | |
| chmod +x ./gradlew | |
| ./gradlew assembleRelease | |
| - name: Verify APK is signed | |
| run: | | |
| apksigner="$ANDROID_HOME/build-tools/$(ls "$ANDROID_HOME/build-tools" | sort -V | tail -1)/apksigner" | |
| apk=$(ls app/build/outputs/apk/release/*.apk | head -1) | |
| "$apksigner" verify --verbose "$apk" | |
| # The release is still a DRAFT here, so the git tag doesn't exist as a real ref yet — a draft | |
| # GitHub release only materialises its tag when published (the last step below). So git-cliff | |
| # can't rely on the tag: `--latest` would resolve to the PREVIOUS release and render its notes. | |
| # Instead render the just-released commits as "unreleased" and stamp them with the release | |
| # version via --tag, so the correct section is produced during the draft window. | |
| - name: Render GitHub Release notes (this release only) | |
| uses: orhun/git-cliff-action@v4 | |
| env: | |
| OUTPUT: RELEASE_NOTES.md | |
| with: | |
| config: cliff.toml | |
| args: --unreleased --tag ${{ needs.release-please.outputs.tag_name }} --strip header | |
| - name: Regenerate full CHANGELOG.md | |
| uses: orhun/git-cliff-action@v4 | |
| env: | |
| OUTPUT: CHANGELOG.md | |
| with: | |
| config: cliff.toml | |
| # Same reason: stamp the yet-untagged release commits with the release version. | |
| args: --tag ${{ needs.release-please.outputs.tag_name }} | |
| - name: Commit CHANGELOG.md | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add CHANGELOG.md | |
| if git diff --staged --quiet; then | |
| echo "changelog unchanged" | |
| else | |
| git commit -m "chore: update changelog [skip ci]" | |
| git push | |
| fi | |
| - name: Publish release with notes + APK | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| TAG: ${{ needs.release-please.outputs.tag_name }} | |
| run: | | |
| gh release edit "$TAG" --notes-file RELEASE_NOTES.md --draft=false | |
| gh release upload "$TAG" app/build/outputs/apk/release/*.apk --clobber |