Skip to content

Commit 3f8e4e3

Browse files
authored
Merge pull request #173 from adobe/dev-actions
Merge `dev-actions` -> `main` for `gha-android-3.4.4` and `gha-ios-5.3.3`
2 parents 68e4884 + 848536e commit 3f8e4e3

16 files changed

+186
-92
lines changed

.github/workflows/android-bom-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
run: make -C android/aepsdk-bom bom-publish-main
5151

5252
- name: Generate JReleaser configuration
53-
uses: adobe/aepsdk-commons/.github/actions/android-setup-jreleaser-configuration@gha-android-3.4.3
53+
uses: adobe/aepsdk-commons/.github/actions/android-setup-jreleaser-configuration@gha-android-3.4.4
5454
with:
5555
staging-dir: android/aepsdk-bom/sdk-bom/build/staging-deploy
5656

.github/workflows/android-bom-snapshot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
run: make -C android/aepsdk-bom bom-publish-snapshot
4444

4545
- name: Generate JReleaser configuration
46-
uses: adobe/aepsdk-commons/.github/actions/android-setup-jreleaser-configuration@gha-android-3.4.3
46+
uses: adobe/aepsdk-commons/.github/actions/android-setup-jreleaser-configuration@gha-android-3.4.4
4747
with:
4848
staging-dir: android/aepsdk-bom/sdk-bom/build/staging-deploy
4949

.github/workflows/android-build-and-test.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# governing permissions and limitations under the License.
1111
#
1212

13-
name: Build and Test (Android)
13+
name: z(Reusable) Build and Test (Android)
1414

1515
on:
1616
workflow_call:
@@ -49,20 +49,20 @@ on:
4949
jobs:
5050
validate-code:
5151
name: Validate Code
52-
uses: adobe/aepsdk-commons/.github/workflows/android-validate-code.yml@gha-android-3.4.3
52+
uses: adobe/aepsdk-commons/.github/workflows/android-validate-code.yml@gha-android-3.4.4
5353

5454
javadoc:
5555
name: Javadoc
5656
needs: validate-code
57-
uses: adobe/aepsdk-commons/.github/workflows/android-javadoc.yml@gha-android-3.4.3
57+
uses: adobe/aepsdk-commons/.github/workflows/android-javadoc.yml@gha-android-3.4.4
5858
with:
5959
javadoc-build-path: ${{ inputs.javadoc-build-path }}
6060

6161
test-unit:
6262
name: Unit Test
6363
needs: validate-code
6464
if: inputs.run-test-unit
65-
uses: adobe/aepsdk-commons/.github/workflows/android-custom-command-build-and-test.yml@gha-android-3.4.3
65+
uses: adobe/aepsdk-commons/.github/workflows/android-custom-command-build-and-test.yml@gha-android-3.4.4
6666
with:
6767
android-api-levels: ${{ inputs.android-api-levels }}
6868
command: make unit-test-coverage
@@ -74,7 +74,7 @@ jobs:
7474
name: Functional Test
7575
needs: validate-code
7676
if: inputs.run-test-functional
77-
uses: adobe/aepsdk-commons/.github/workflows/android-custom-command-build-and-test.yml@gha-android-3.4.3
77+
uses: adobe/aepsdk-commons/.github/workflows/android-custom-command-build-and-test.yml@gha-android-3.4.4
7878
with:
7979
android-api-levels: ${{ inputs.android-api-levels }}
8080
command: make functional-test-coverage
@@ -86,7 +86,7 @@ jobs:
8686
name: Integration Test
8787
needs: validate-code
8888
if: inputs.run-test-integration
89-
uses: adobe/aepsdk-commons/.github/workflows/android-custom-command-build-and-test.yml@gha-android-3.4.3
89+
uses: adobe/aepsdk-commons/.github/workflows/android-custom-command-build-and-test.yml@gha-android-3.4.4
9090
with:
9191
android-api-levels: ${{ inputs.android-api-levels }}
9292
command: make integration-test-coverage
@@ -105,7 +105,7 @@ jobs:
105105
uses: actions/checkout@v4.2.2
106106

107107
- name: Setup Dependencies
108-
uses: adobe/aepsdk-commons/.github/actions/android-setup-dependencies-action@gha-android-3.4.3
108+
uses: adobe/aepsdk-commons/.github/actions/android-setup-dependencies-action@gha-android-3.4.4
109109

110110
- name: Assemble App
111111
run: make assemble-app

.github/workflows/android-custom-command-build-and-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# governing permissions and limitations under the License.
1111
#
1212

13-
name: Custom Command Build and Test (Android)
13+
name: z(Reusable) Custom Command Build and Test (Android)
1414

1515
on:
1616
workflow_call:
@@ -113,7 +113,7 @@ jobs:
113113
steps:
114114
- name: Setup Dependencies
115115
id: setup-dependencies
116-
uses: adobe/aepsdk-commons/.github/actions/android-setup-dependencies-action@gha-android-3.4.3
116+
uses: adobe/aepsdk-commons/.github/actions/android-setup-dependencies-action@gha-android-3.4.4
117117
with:
118118
android-api-level: ${{ matrix.api-level }}
119119

.github/workflows/android-javadoc.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# governing permissions and limitations under the License.
1111
#
1212

13-
name: Javadoc
13+
name: z(Reusable) Javadoc
1414

1515
on:
1616
workflow_call:
@@ -33,7 +33,7 @@ jobs:
3333

3434
- name: Setup Dependencies
3535
id: setup-dependencies
36-
uses: adobe/aepsdk-commons/.github/actions/android-setup-dependencies-action@gha-android-3.4.3
36+
uses: adobe/aepsdk-commons/.github/actions/android-setup-dependencies-action@gha-android-3.4.4
3737

3838
- name: Javadoc
3939
run: make javadoc

.github/workflows/android-maven-release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# governing permissions and limitations under the License.
1111
#
1212

13-
name: Publish Release (Android)
13+
name: z(Reusable) Publish Release (Android)
1414

1515
# Workflow requirements:
1616
#
@@ -104,7 +104,7 @@ on:
104104
jobs:
105105
validate-versions:
106106
name: Validate Versions
107-
uses: adobe/aepsdk-commons/.github/workflows/versions.yml@gha-android-3.4.3
107+
uses: adobe/aepsdk-commons/.github/workflows/versions.yml@gha-android-3.4.4
108108
with:
109109
name: ${{ inputs.version-validation-name }}
110110
version: ${{ github.event.inputs.tag }}
@@ -181,7 +181,7 @@ jobs:
181181
fi
182182
183183
- name: Generate JReleaser configuration
184-
uses: adobe/aepsdk-commons/.github/actions/android-setup-jreleaser-configuration@gha-android-3.4.3
184+
uses: adobe/aepsdk-commons/.github/actions/android-setup-jreleaser-configuration@gha-android-3.4.4
185185
with:
186186
staging-dir: ${{ inputs.staging-dir }}
187187

.github/workflows/android-maven-snapshot.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# governing permissions and limitations under the License.
1111
#
1212

13-
name: Publish Snapshot (Android)
13+
name: z(Reusable) Publish Snapshot (Android)
1414

1515
# Workflow requirements:
1616
#
@@ -93,7 +93,7 @@ jobs:
9393
fi
9494
9595
- name: Generate JReleaser configuration
96-
uses: adobe/aepsdk-commons/.github/actions/android-setup-jreleaser-configuration@gha-android-3.4.3
96+
uses: adobe/aepsdk-commons/.github/actions/android-setup-jreleaser-configuration@gha-android-3.4.4
9797
with:
9898
staging-dir: ${{ inputs.staging-dir }}
9999

.github/workflows/android-validate-code.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# governing permissions and limitations under the License.
1111
#
1212

13-
name: Validate Code (Android)
13+
name: z(Reusable) Validate Code (Android)
1414

1515
on:
1616
workflow_call:
@@ -26,7 +26,7 @@ jobs:
2626

2727
- name: Setup Dependencies
2828
id: setup-dependencies
29-
uses: adobe/aepsdk-commons/.github/actions/android-setup-dependencies-action@gha-android-3.4.3
29+
uses: adobe/aepsdk-commons/.github/actions/android-setup-dependencies-action@gha-android-3.4.4
3030

3131
- name: Lint Source Code
3232
run: make lint
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#
2+
# Copyright 2025 Adobe. All rights reserved.
3+
# This file is licensed to you under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License. You may obtain a copy
5+
# of the License at http://www.apache.org/licenses/LICENSE-2.0
6+
#
7+
# Unless required by applicable law or agreed to in writing, software distributed under
8+
# the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9+
# OF ANY KIND, either express or implied. See the License for the specific language
10+
# governing permissions and limitations under the License.
11+
#
12+
13+
name: Auto downmerge main into dev branches
14+
15+
on:
16+
push:
17+
branches: [main]
18+
pull_request:
19+
types: [closed]
20+
branches: [main]
21+
22+
jobs:
23+
call-downmerge:
24+
# This checks that a PR was merged, not just closed
25+
if: github.event_name == 'push' || github.event.pull_request.merged == true
26+
uses: ./.github/workflows/downmerge-to-dev.yml
27+
with:
28+
target-branches: "dev dev-actions"
29+
secrets: inherit

.github/workflows/downmerge-to-dev.yml

Lines changed: 79 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,23 @@
1010
# governing permissions and limitations under the License.
1111
#
1212

13-
name: Downmerge main -> dev
13+
name: z(Reusable) Downmerge main -> dev
1414

1515
on:
1616
workflow_call:
1717
inputs:
18-
dev-branch-name:
19-
description: 'Branch to receive changes from main. Default is "dev".'
18+
source-branch-name:
19+
description: 'Branch to merge from. Default is "main".'
20+
type: string
21+
default: 'main'
22+
23+
target-branches:
24+
description: 'Space separated list of branches that should receive pull requests. Example: "dev dev-actions"'
2025
type: string
2126
default: 'dev'
2227

23-
create-new-branch:
24-
description: 'Create a new branch from main instead of merging main into the dev branch. Default is false.'
28+
increment-target-branch:
29+
description: 'If true, automatically compute and create the next semver branch, where target-branches is interpreted as a list of prefixes. Example: "dev- dev-v" (dev-1.2.3, dev-v1.2.3 exist) → "dev-1.2.4 dev-v1.2.4"'
2530
type: boolean
2631
default: false
2732

@@ -31,11 +36,14 @@ jobs:
3136
permissions:
3237
contents: write
3338
pull-requests: write
39+
env:
40+
GH_TOKEN: ${{ github.token }}
3441

3542
steps:
3643
- name: Check out repository
3744
uses: actions/checkout@v4.2.2
3845
with:
46+
ref: ${{ inputs.source-branch-name }}
3947
# Allows merging/pulling across branches
4048
fetch-depth: 0
4149

@@ -44,32 +52,72 @@ jobs:
4452
git config user.name "github-actions[bot]"
4553
git config user.email "github-actions[bot]@users.noreply.github.com"
4654
47-
- name: Create or determine branch
48-
id: create_branch
49-
run: |
50-
if [ "${{ inputs.create-new-branch }}" = "true" ]; then
51-
# Create the specified dev branch from main and exit
52-
git checkout main
53-
git checkout -b "${{ inputs.dev-branch-name }}"
54-
git push origin "${{ inputs.dev-branch-name }}"
55-
echo "create_pr=false" >> $GITHUB_OUTPUT
56-
else
57-
# Use main as the head branch for PR
58-
echo "create_pr=true" >> $GITHUB_OUTPUT
59-
fi
60-
61-
- name: Create pull request
62-
if: steps.create_branch.outputs.create_pr == 'true'
55+
- name: Down-merge logic
6356
env:
64-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57+
SOURCE: ${{ inputs.source-branch-name }}
58+
TARGETS: ${{ inputs.target-branches }}
59+
INCREMENT: ${{ inputs.increment-target-branch }}
6560
run: |
66-
base="${{ inputs.dev-branch-name }}"
67-
head="main"
68-
title="Downmerge main -> $base"
69-
body="Opening a pull request to bring main changes into $base."
61+
set -e
62+
# If increment flag is set, treat TARGETS as list of prefixes and compute next semver branch for each
63+
if [ "$INCREMENT" = "true" ]; then
64+
echo "Increment mode enabled – will create next semver branch for each prefix in '$TARGETS'"
65+
NEW_TARGETS=""
66+
for prefix in $TARGETS; do
67+
echo "Processing prefix: $prefix"
68+
# find latest branch with this prefix
69+
latest=$(git ls-remote --heads origin "refs/heads/${prefix}*" | awk '{print $2}' | sed -E "s#refs/heads/${prefix}##" | sort -t'.' -k1,1V -k2,2V -k3,3V | tail -n1)
70+
if [ -z "$latest" ]; then
71+
echo "No existing branches found for prefix '$prefix'; skipping."
72+
continue
73+
fi
74+
IFS='.' read -r major minor patch <<< "$latest"
75+
patch=$((patch+1))
76+
new_branch="${prefix}${major}.${minor}.${patch}"
77+
echo "Next branch for prefix '$prefix' will be $new_branch"
78+
# Prevent duplicates
79+
if [[ " $NEW_TARGETS " == *" $new_branch "* ]]; then
80+
echo "Duplicate branch $new_branch detected – skipping duplicate entry."
81+
else
82+
NEW_TARGETS="$NEW_TARGETS $new_branch"
83+
fi
84+
done
85+
TARGETS=$(echo "$NEW_TARGETS" | tr ' ' '\n' | sort -u | xargs) # trim whitespace & dedupe
86+
if [ -z "$TARGETS" ]; then
87+
echo "No new branches were generated. Exiting workflow."
88+
exit 0
89+
fi
90+
echo "Computed TARGETS: $TARGETS"
91+
fi
7092
71-
gh pr create \
72-
--base "$base" \
73-
--head "$head" \
74-
--title "$title" \
75-
--body "$body"
93+
for base in $TARGETS; do
94+
if ! git ls-remote --heads origin "$base" | grep -q "$base"; then
95+
if [ "$INCREMENT" = "true" ]; then
96+
echo "Creating new branch '$base' from '$SOURCE' (increment mode)"
97+
git checkout "$SOURCE"
98+
git checkout -b "$base"
99+
git push origin "$base"
100+
continue
101+
else
102+
echo "Target branch '$base' does not exist and increment mode is off – skipping."
103+
continue
104+
fi
105+
fi
106+
# PR workflow (branch exists)
107+
# Skip creating PR if branches point to same commit
108+
if [ "$(git rev-parse $SOURCE)" = "$(git rev-parse origin/$base)" ]; then
109+
echo "No changes between $SOURCE and $base – skipping PR."
110+
continue
111+
fi
112+
echo "Creating PR from $SOURCE into $base"
113+
# skip if open PR already exists
114+
if gh pr list --base "$base" --head "$SOURCE" --state open --json number -q '.[0]' | grep -q '[0-9]'; then
115+
echo "PR already exists for $base – skipping."
116+
continue
117+
fi
118+
gh pr create \
119+
--base "$base" \
120+
--head "$SOURCE" \
121+
--title "Downmerge \`$SOURCE\` -> \`$base\`" \
122+
--body "Automatically bringing changes from \`$SOURCE\` into \`$base\`." || true
123+
done

0 commit comments

Comments
 (0)