chore(release): bump versionName to 1.3.0-rc.3 (#227) #41
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: Release APK | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| permissions: | |
| contents: write | |
| pull-requests: read | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: zulu | |
| java-version: '21' | |
| - name: Set up Gradle | |
| uses: gradle/actions/setup-gradle@v6 | |
| - name: Decode keystore | |
| run: echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 -d > app/release.keystore | |
| - name: Build release APK | |
| run: ./gradlew assembleRelease | |
| env: | |
| STRIMMA_KEYSTORE_FILE: release.keystore | |
| STRIMMA_KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} | |
| STRIMMA_KEY_ALIAS: ${{ secrets.KEY_ALIAS }} | |
| STRIMMA_KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }} | |
| - name: Run tests | |
| run: ./gradlew testDebugUnitTest | |
| - name: Create GitHub Release | |
| run: | | |
| VERSION="${GITHUB_REF_NAME#v}" | |
| APK="strimma-${VERSION}.apk" | |
| cp app/build/outputs/apk/release/app-release.apk "$APK" | |
| PREV_TAG=$(git tag --sort=-v:refname | grep '^v' | sed -n '2p') | |
| PRERELEASE_FLAG="" | |
| if [[ "$VERSION" == *-rc.* ]] || [[ "$VERSION" == *-beta.* ]]; then | |
| PRERELEASE_FLAG="--prerelease" | |
| fi | |
| # Extract release notes from the release PR body (between ```markdown fences). | |
| # Look up the PR by the tagged commit SHA — the tag points to the squash-merge | |
| # commit on main, which maps to exactly one PR. Title-based search is too loose | |
| # (e.g. "Release v1.2.0" matches "Release v1.2.0-rc.2"). | |
| PR_DATA=$(gh api "repos/${{ github.repository }}/commits/${{ github.sha }}/pulls" --jq '.[0] // empty') | |
| PR_NUMBER=$(echo "$PR_DATA" | jq -r '.number // empty') | |
| NOTES=$(echo "$PR_DATA" | jq -r '.body // empty' \ | |
| | sed -n '/^```markdown$/,/^```$/{ /^```/d; p; }') | |
| # For prereleases, prepend a link to the release PR so the testing-plan | |
| # checklist (which lives outside the fenced block) is one click away. | |
| if [ -n "$NOTES" ] && [ -n "$PR_NUMBER" ] && [ -n "$PRERELEASE_FLAG" ]; then | |
| NOTES=$(printf '**Test plan & verification:** [#%s](https://github.com/%s/pull/%s)\n\n---\n\n%s\n' \ | |
| "$PR_NUMBER" "${{ github.repository }}" "$PR_NUMBER" "$NOTES") | |
| fi | |
| if [ -n "$NOTES" ]; then | |
| gh release create "${{ github.ref_name }}" \ | |
| "$APK" \ | |
| --notes "$NOTES" \ | |
| $PRERELEASE_FLAG | |
| else | |
| gh release create "${{ github.ref_name }}" \ | |
| "$APK" \ | |
| --generate-notes \ | |
| --notes-start-tag "$PREV_TAG" \ | |
| $PRERELEASE_FLAG | |
| fi | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |