Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/android-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ jobs:

- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Test release tooling
run: >-
python3 -m unittest
scripts/test_release_tool.py
scripts/test_release_workflows.py
scripts/test_release_protection.py
- name: Build with Gradle
run: ./gradlew test
- uses: actions/upload-artifact@v6
Expand Down
71 changes: 52 additions & 19 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
@@ -1,52 +1,71 @@
name: Create Android Release

on:
pull_request:
branches: [master]
types: [closed]
workflow_dispatch:
inputs:
version:
description: Expected versionName without the v prefix
head_branch:
description: Merged release/* or hotfix/* branch for recovery
required: true
type: string
commit_sha:
description: Exact merged master commit to tag
description: Exact merge commit contained in master
required: true
type: string

permissions:
contents: write
checks: read
pull-requests: read

concurrency:
group: android-release-${{ github.event.pull_request.merge_commit_sha || inputs.commit_sha }}
cancel-in-progress: false

jobs:
create-tag:
if: >-
github.event_name == 'workflow_dispatch' ||
(github.event.pull_request.merged == true &&
(startsWith(github.event.pull_request.head.ref, 'release/') ||
startsWith(github.event.pull_request.head.ref, 'hotfix/')))
runs-on: ubuntu-latest
environment: release
outputs:
tag: ${{ steps.identity.outputs.tag }}
steps:
- uses: actions/checkout@v6
with:
ref: master
ref: ${{ github.event.pull_request.merge_commit_sha || inputs.commit_sha }}
fetch-depth: 0
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
bundler-cache: true
- name: Verify exact master commit
- name: Fetch stable history and tags
run: git fetch origin master --tags
- name: Require successful protected pull-request checks
if: github.event_name == 'pull_request'
env:
EXPECTED_SHA: ${{ inputs.commit_sha }}
run: |
git fetch origin master --tags
test "$(git rev-parse HEAD)" = "$EXPECTED_SHA"
test "$(git rev-parse origin/master)" = "$EXPECTED_SHA"
- name: Resolve and verify identity
GH_TOKEN: ${{ github.token }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: gh pr checks "$PR_NUMBER" --required
- name: Resolve merged release identity
id: identity
env:
EXPECTED_VERSION: ${{ inputs.version }}
HEAD_BRANCH: ${{ github.event.pull_request.head.ref || inputs.head_branch }}
BASE_BRANCH: ${{ github.event.pull_request.base.ref || 'master' }}
MERGE_COMMIT: ${{ github.event.pull_request.merge_commit_sha || inputs.commit_sha }}
MERGED: ${{ github.event_name == 'workflow_dispatch' || github.event.pull_request.merged }}
run: |
python3 scripts/release_tool.py metadata > release-metadata.json
ACTUAL_VERSION=$(python3 -c 'import json; print(json.load(open("release-metadata.json"))["versionName"])')
TAG=$(python3 -c 'import json; print(json.load(open("release-metadata.json"))["tag"])')
test "$ACTUAL_VERSION" = "$EXPECTED_VERSION"
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
python3 scripts/release_tool.py candidate \
--head-branch "$HEAD_BRANCH" \
--base-branch "$BASE_BRANCH" \
--merge-commit "$MERGE_COMMIT" \
--merged "$MERGED" > release-candidate.json
echo "tag=$(python3 -c 'import json; print(json.load(open("release-candidate.json"))["tag"])')" >> "$GITHUB_OUTPUT"
- name: Decode Google Play service account
env:
SERVICE_ACCOUNT_BASE64: ${{ secrets.GOOGLE_PLAY_SERVICE_ACCOUNT }}
Expand All @@ -58,12 +77,12 @@ jobs:
- name: Create immutable annotated tag
env:
TAG: ${{ steps.identity.outputs.tag }}
EXPECTED_SHA: ${{ inputs.commit_sha }}
MERGE_COMMIT: ${{ github.event.pull_request.merge_commit_sha || inputs.commit_sha }}
run: |
test -z "$(git tag --list "$TAG")"
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git tag -a "$TAG" "$EXPECTED_SHA" -m "Release $TAG"
git tag -a "$TAG" "$MERGE_COMMIT" -m "Release $TAG"
git push origin "refs/tags/$TAG"

publish:
Expand All @@ -72,3 +91,17 @@ jobs:
with:
tag: ${{ needs.create-tag.outputs.tag }}
secrets: inherit

sync-development:
needs: [create-tag, publish]
uses: ./.github/workflows/sync-master-to-dev.yml
with:
tag: ${{ needs.create-tag.outputs.tag }}
secrets: inherit

promote-production:
needs: [create-tag, publish]
uses: ./.github/workflows/promote-production.yml
with:
tag: ${{ needs.create-tag.outputs.tag }}
secrets: inherit
21 changes: 12 additions & 9 deletions .github/workflows/promote-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ on:
description: Immutable v<versionName> release tag
required: true
type: string
version_code:
description: Existing internal-track versionCode
workflow_call:
inputs:
tag:
required: true
type: number
type: string

permissions:
contents: read
Expand All @@ -28,26 +29,28 @@ jobs:
with:
ruby-version: '3.3'
bundler-cache: true
- name: Verify tag, commit, and versionCode
- name: Verify tag and derive versionCode
id: identity
env:
TAG: ${{ inputs.tag }}
EXPECTED_CODE: ${{ inputs.version_code }}
run: |
git fetch origin --tags
test "$(git cat-file -t "$TAG")" = "tag"
test "$(git rev-parse HEAD)" = "$(git rev-list -n 1 "$TAG")"
test "$(python3 scripts/release_tool.py metadata | python3 -c 'import json,sys; print(json.load(sys.stdin)["tag"])')" = "$TAG"
test "$(python3 scripts/release_tool.py metadata | python3 -c 'import json,sys; print(json.load(sys.stdin)["versionCode"])')" = "$EXPECTED_CODE"
python3 scripts/release_tool.py metadata > release-metadata.json
test "$(python3 -c 'import json; print(json.load(open("release-metadata.json"))["tag"])')" = "$TAG"
echo "version_code=$(python3 -c 'import json; print(json.load(open("release-metadata.json"))["versionCode"])')" >> "$GITHUB_OUTPUT"
- name: Decode Google Play service account
env:
SERVICE_ACCOUNT_BASE64: ${{ secrets.GOOGLE_PLAY_SERVICE_ACCOUNT }}
run: printf '%s' "$SERVICE_ACCOUNT_BASE64" | base64 --decode > service-account.json
- name: Require the exact version on internal
run: >-
bundle exec fastlane android assert_track_version_code
version_code:${{ inputs.version_code }} track:internal
version_code:${{ steps.identity.outputs.version_code }} track:internal
json_key:${{ github.workspace }}/service-account.json
- name: Promote existing internal artifact to completed production
run: >-
bundle exec fastlane android promote_release
version_code:${{ inputs.version_code }}
version_code:${{ steps.identity.outputs.version_code }}
json_key:${{ github.workspace }}/service-account.json
6 changes: 5 additions & 1 deletion .github/workflows/release-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ jobs:
- name: Validate release identity and localized notes
run: python3 scripts/release_tool.py validate
- name: Test release tooling
run: python3 -m unittest scripts/test_release_tool.py
run: >-
python3 -m unittest
scripts/test_release_tool.py
scripts/test_release_workflows.py
scripts/test_release_protection.py
- name: Test, lint, and assemble release outputs
run: ./gradlew test lint assembleRelease bundleRelease --no-daemon
- name: Verify assembled release identity
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/sync-master-to-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ on:
description: Released v<versionName> tag on master
required: true
type: string
workflow_call:
inputs:
tag:
required: true
type: string

permissions:
contents: write
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ in pipeline an application uses [maxistar/android](https://github.com/maxistar/a

You can use [this service](https://crowdin.com/project/simple-text-editor) to add a new translation or suggest better one

### Maintainer documentation

- [Android release process](docs/RELEASING.md)

### To Do

many many things to do.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ apply plugin: 'com.android.application'
android {
defaultConfig {
applicationId "com.maxistar.textpad"
versionCode 62
versionName "1.31.1"
versionCode 63
versionName "1.31.2"
minSdkVersion 21
compileSdkVersion 36
targetSdkVersion 36
Expand Down
Loading
Loading