Skip to content

Commit 036ac7e

Browse files
committed
WIP: Automated Android branch builds
1 parent 9818850 commit 036ac7e

File tree

3 files changed

+62
-5
lines changed

3 files changed

+62
-5
lines changed

Diff for: .github/workflows/android_builds.yml

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
on:
2+
pull_request:
3+
branches:
4+
- main
5+
# types:
6+
# - closed
7+
8+
name: Update Android Artifacts
9+
10+
permissions:
11+
contents: write
12+
13+
jobs:
14+
update-android-branch:
15+
# if: github.event.pull_request.merged == true
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v3
19+
20+
- name: Setup Java
21+
uses: actions/setup-java@v3
22+
with:
23+
java-version: "17"
24+
distribution: "temurin"
25+
26+
- name: Validate Gradle Wrappers
27+
uses: gradle/wrapper-validation-action@56b90f209b02bf6d1deae490e9ef18b21a389cd4 # 1.1.0
28+
29+
# Configure a committer identity and obtain information
30+
# about the `main-with-maven` branch.
31+
- name: Configure Git
32+
run: |
33+
git config --global user.name "Android Builder"
34+
git config --global user.email "[email protected]"
35+
git fetch --all
36+
37+
# Build up the same Maven local repository that would be used for
38+
# a crates.io release and commit it to the dedicated Android branch.
39+
- name: Package Android AAR
40+
run: |
41+
echo "Syncing main branch state to the Maven hosting branch"
42+
git checkout -b main-with-maven
43+
# git reset --hard origin/main
44+
git reset --hard origin/automated-android-branch
45+
46+
echo "Building new Android release from main"
47+
./ci/package_android_release.sh
48+
49+
git add --force android-release-support/*
50+
git commit -am "[Automated] Bundle Android component artifacts"
51+
# git push -f origin main-with-maven
52+
git push -f origin HEAD:main-with-maven

Diff for: .github/workflows/ci.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ on:
33
branches:
44
- main
55
- "*_dev"
6-
pull_request:
7-
merge_group:
8-
schedule:
9-
- cron: '0 18 * * *'
6+
#pull_request:
7+
# merge_group:
8+
#schedule:
9+
# - cron: '0 18 * * *'
1010

1111
name: CI
1212
permissions:

Diff for: ci/package_android_release.sh

+6-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ artifact_path="../android/rustls-platform-verifier/build/outputs/aar/$artifact_n
3333
git clean -dfX "./maven/"
3434

3535
cp ./pom-template.xml ./maven/pom.xml
36-
sed -i "" "s/\$VERSION/$version/" ./maven/pom.xml
36+
37+
# This sequence is meant to workaround the incompatibilites between macOS's sed
38+
# command and the GNU command. Referenced from the following:
39+
# https://stackoverflow.com/questions/5694228/sed-in-place-flag-that-works-both-on-mac-bsd-and-linux
40+
sed -i.bak "s/\$VERSION/$version/" ./maven/pom.xml
41+
rm ./maven/pom.xml.bak
3742

3843
mvn install:install-file -Dfile="$artifact_path" -Dpackaging="aar" -DpomFile="./maven/pom.xml" -DlocalRepositoryPath="./maven/"

0 commit comments

Comments
 (0)