Skip to content
Closed
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
87 changes: 87 additions & 0 deletions .github/workflows/post_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Post Release - Prepare Main for Next Development Cycle

on:
workflow_dispatch:

env:
AWS_DEFAULT_REGION: us-west-2

permissions:
id-token: write
contents: write
pull-requests: write

jobs:
prepare-main:
runs-on: ubuntu-latest
needs: check-version
steps:
- name: Checkout main
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 #v5.0.0
with:
ref: main
fetch-depth: 0
- name: Configure AWS credentials for BOT secrets
uses: aws-actions/configure-aws-credentials@a03048d87541d1d9fcf2ecf528a4a65ba9bd7838 #v5.0.0
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN_SECRETS_MANAGER }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}

- name: Get Bot secrets
uses: aws-actions/aws-secretsmanager-get-secrets@a9a7eb4e2f2871d30dc5b892576fde60a2ecc802 #v2.0.10
id: bot_secrets
with:
secret-ids: |
BOT_TOKEN ,${{ secrets.BOT_TOKEN_SECRET_ARN }}
parse-json-secrets: true

- name: Setup Git
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 #v5.0.0
with:
fetch-depth: 0
token: ${{ env.BOT_TOKEN_GITHUB_RW_PATOKEN }}

- name: Configure Git
run: |
git config user.name "github-actions"
git config user.email "github-actions@github.com"

- name: Get current version
run: |
# Get current version from gradle.properties
CURRENT_VERSION=$(grep '^version=' gradle.properties | cut -d'=' -f2)
echo "Current version: $CURRENT_VERSION"
echo "CURRENT_VERSION=$CURRENT_VERSION" >> $GITHUB_ENV

- name: Make bump-version.sh executable and bump minor version
run: |
chmod +x scripts/bump-version.sh

# Use bump-version.sh to bump minor version (auto-confirms with 'y')
echo "y" | ./scripts/bump-version.sh minor

# Get the new version
NEW_VERSION=$(grep '^version=' gradle.properties | cut -d'=' -f2)
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
echo "Next version will be: $NEW_VERSION"

- name: Create branch and commit changes
run: |
git checkout -b "prepare-main-for-next-dev-cycle-${NEW_VERSION}" main

git add gradle.properties README.md
git commit -m "Prepare main for next development cycle: Update version to $NEW_VERSION"
git push --set-upstream origin "prepare-main-for-next-dev-cycle-${NEW_VERSION}"

- name: Create Pull Request to main
env:
GITHUB_TOKEN: ${{ env.BOT_TOKEN_GITHUB_RW_PATOKEN }}
run: |
gh pr create --title "Post release: Update version to $NEW_VERSION" \
--body "This PR prepares the main branch for the next development cycle by updating the version to $NEW_VERSION in gradle.properties.

This PR should only be merged when the release is successful.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice." \
--head prepare-main-for-next-dev-cycle-${NEW_VERSION} \
--base main
110 changes: 110 additions & 0 deletions .github/workflows/pre_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: Pre Release Prepare - Update Version and Create PR

on:
workflow_dispatch:
inputs:
is_patch:
description: 'Is this a patch? (true or false)'
required: true
default: 'false'

env:
AWS_DEFAULT_REGION: us-west-2

permissions:
contents: write
pull-requests: write
id-token: write


jobs:
update-version-and-create-pr:
runs-on: ubuntu-latest
steps:
- name: Configure AWS credentials for BOT secrets
uses: aws-actions/configure-aws-credentials@a03048d87541d1d9fcf2ecf528a4a65ba9bd7838 #v5.0.0
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN_SECRETS_MANAGER }}
role-session-name: GitHubActions-PreRelease
aws-region: ${{ env.AWS_DEFAULT_REGION }}
audience: sts.amazonaws.com

- name: Get Bot secrets
uses: aws-actions/aws-secretsmanager-get-secrets@a9a7eb4e2f2871d30dc5b892576fde60a2ecc802 #v2.0.10
id: bot_secrets
with:
secret-ids: |
BOT_TOKEN,${{ secrets.BOT_TOKEN_SECRET_ARN }}

- name: Set environment variables
run: |
echo "BOT_TOKEN_GITHUB_RW_PATOKEN=${{ env.BOT_TOKEN }}" >> $GITHUB_ENV

- name: Checkout main branch
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 #v5.0.0
with:
ref: 'main'
token: ${{ env.BOT_TOKEN_GITHUB_RW_PATOKEN }}

- name: Setup Git
run: |
git config user.name "github-actions"
git config user.email "github-actions@github.com"

- name: Extract version from gradle.properties
run: |
VERSION=$(grep '^version=' gradle.properties | cut -d'=' -f2)
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "MAJOR_MINOR=$(echo $VERSION | sed -E 's/([0-9]+\.[0-9]+)\.[0-9]+/\1/')" >> $GITHUB_ENV

- name: Create branches
run: |
IS_PATCH=${{ github.event.inputs.is_patch }}
if [[ "$IS_PATCH" != "true" && "$IS_PATCH" != "false" ]]; then
echo "Invalid input for IS_PATCH. Must be 'true' or 'false'."
exit 1
fi


if git ls-remote --heads origin release/v${MAJOR_MINOR}.x | grep -q "release/v${MAJOR_MINOR}.x"; then
if [ "$IS_PATCH" = "true" ]; then
git fetch origin release/v${MAJOR_MINOR}.x
echo "Branch release/v${MAJOR_MINOR}.x already exists, checking out."
git checkout "release/v${MAJOR_MINOR}.x"
else
echo "Error, release series branch release/v${MAJOR_MINOR}.x exist for non-patch release"
echo "Check your input or branch"
exit 1
fi
else
if [ "$IS_PATCH" = "true" ]; then
echo "Error, release series branch release/v${MAJOR_MINOR}.x NOT exist for patch release"
echo "Check your input or branch"
exit 1
else
echo "Creating branch release/v${MAJOR_MINOR}.x."
git checkout -b "release/v${MAJOR_MINOR}.x"
git push origin "release/v${MAJOR_MINOR}.x"
fi
fi

git checkout -b "v${VERSION}_release"
git push origin "v${VERSION}_release"

- name: Update CHANGELOG for release
run: |
sed -i "s/## Unreleased/## Unreleased\n\n## v${VERSION} - $(date +%Y-%m-%d)/" CHANGELOG.md
git add CHANGELOG.md
git commit -m "Update CHANGELOG for version ${VERSION}"
git push origin "v${VERSION}_release"

- name: Create pull request against the release branch
env:
GITHUB_TOKEN: ${{ env.BOT_TOKEN_GITHUB_RW_PATOKEN }}
run: |
gh pr create --title "Pre-release: Update version to ${VERSION}" \
--body "This PR updates the version to ${VERSION}.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice." \
--head v${VERSION}_release \
--base release/v${MAJOR_MINOR}.x
83 changes: 83 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Release Build and Publish to Maven Central

on:
workflow_dispatch:

env:
AWS_DEFAULT_REGION: us-west-2

permissions:
contents: write
id-token: write

jobs:
build-and-publish:
environment: Release
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 #v5.0.0

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'

- name: Setup Android SDK
uses: android-actions/setup-android@v3

- name: Configure AWS credentials for secrets
uses: aws-actions/configure-aws-credentials@a03048d87541d1d9fcf2ecf528a4a65ba9bd7838 #v5.0.0
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN_SECRETS_MANAGER }}
role-session-name: GitHubActions-Release
aws-region: ${{ env.AWS_DEFAULT_REGION }}
audience: sts.amazonaws.com

- name: Get Maven Central secrets
uses: aws-actions/aws-secretsmanager-get-secrets@a9a7eb4e2f2871d30dc5b892576fde60a2ecc802 #v2.0.10
with:
secret-ids: |
MAVEN_CENTRAL_USERNAME,${{ secrets.MAVEN_CENTRAL_USERNAME_SECRET_ARN }}
MAVEN_CENTRAL_PASSWORD,${{ secrets.MAVEN_CENTRAL_PASSWORD_SECRET_ARN }}
SIGNING_KEY,${{ secrets.SIGNING_KEY_SECRET_ARN }}
SIGNING_PASSWORD,${{ secrets.SIGNING_PASSWORD_SECRET_ARN }}

- name: Set Maven Central credentials as environment variables
run: |
echo "ORG_GRADLE_PROJECT_sonatypeUsername=${{ env.MAVEN_CENTRAL_USERNAME }}" >> $GITHUB_ENV
echo "ORG_GRADLE_PROJECT_sonatypePassword=${{ env.MAVEN_CENTRAL_PASSWORD }}" >> $GITHUB_ENV
echo "ORG_GRADLE_PROJECT_signing.keyId=${{ env.SIGNING_KEY_ID }}" >> $GITHUB_ENV
echo "ORG_GRADLE_PROJECT_signing.password=${{ env.SIGNING_PASSWORD }}" >> $GITHUB_ENV
echo "ORG_GRADLE_PROJECT_signing.secretKeyRingFile=secring.gpg" >> $GITHUB_ENV

- name: Decode and save signing key
run: |
echo "${{ env.SIGNING_KEY }}" | base64 -d > secring.gpg

- name: Extract version from gradle.properties
run: |
VERSION=$(grep '^version=' gradle.properties | cut -d'=' -f2)
echo "VERSION=$VERSION" >> $GITHUB_ENV

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Build and publish to Maven Central
run: |
./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository

- name: Create GitHub release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create --target "$GITHUB_REF_NAME" \
--title "Release v${VERSION}" \
--draft \
"v${VERSION}"

- name: Clean up signing key
if: always()
run: |
rm -f secring.gpg
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,45 @@ Explore our comprehensive [demo applications](demo-apps/):
- **[Crash Demo](demo-apps/crash-demo/)** - Crash reporting demonstration
- **[ANR Demo](demo-apps/anr-demo/)** - ANR detection example

## Version Management

### Version Bumping

The repository includes a script to manage version bumping across relevant files. The script updates versions in:
- `gradle.properties` (project version)
- `README.md` (documentation references, if any)

#### Manual Version Bumping

Use the `scripts/bump-version.sh` script for version control:

**Patch Version** (x.y.z → x.y.z+1):
```bash
./scripts/bump-version.sh patch
```

**Minor Version** (x.y.z → x.y+1.0):
```bash
./scripts/bump-version.sh minor
```

**Major Version** (x.y.z → x+1.0.0):
```bash
./scripts/bump-version.sh major
```

**Specific Version**:
```bash
./scripts/bump-version.sh 2.1.3
```

**With Automatic Commit and Tag**:
```bash
./scripts/bump-version.sh patch --commit-tag
```

The script will prompt for confirmation before making changes and creates backups of modified files.

## Contributing

We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details on:
Expand Down
12 changes: 7 additions & 5 deletions buildSrc/src/main/kotlin/adot.android-library.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@ android {
targetCompatibility(javaVersion)
}

kotlinOptions {
jvmTarget = javaVersion.toString()
apiVersion = minKotlinVersion.version
languageVersion = minKotlinVersion.version
freeCompilerArgs = listOf("-Xjvm-default=all")
kotlin {
compilerOptions {
jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.fromTarget(javaVersion.toString()))
apiVersion.set(minKotlinVersion)
languageVersion.set(minKotlinVersion)
freeCompilerArgs.add("-Xjvm-default=all")
}
}

sourceSets {
Expand Down
Loading
Loading