Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update GitHub Action workflows to use aepsdk-commons #171

Merged
merged 21 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
d6ced6e
Update update versions workflow to use aepsdk-commons reusable workflow
timkimadobe Oct 23, 2024
9386c93
Update maven release and snapshot workflows to use reusable workflows
timkimadobe Oct 24, 2024
260ff4c
Add workflow_tag input
timkimadobe Oct 24, 2024
c50df5d
Add pr permissions
timkimadobe Oct 24, 2024
4b873ea
Update config to prod
timkimadobe Oct 24, 2024
036833c
Apply testing config
timkimadobe Oct 24, 2024
a35eb5a
Revert "Apply testing config"
timkimadobe Oct 24, 2024
1f355bf
Update example versions to 1.2.3 for consistency
timkimadobe Oct 24, 2024
ded1168
Update input ordering for consistency
timkimadobe Oct 24, 2024
2b7b5c7
Update doc styling
timkimadobe Oct 24, 2024
e21e498
Fix tagged version used for update version workflow
timkimadobe Oct 25, 2024
f80795b
Add license header back to update version workflow
timkimadobe Oct 29, 2024
fd32eb0
Update update version workflow input descriptions to better describe …
timkimadobe Oct 29, 2024
07bd896
Update parameter name to latest
timkimadobe Oct 30, 2024
b44f528
Switch description multiline type
timkimadobe Oct 30, 2024
8739d7e
Remove default from mandatory fields to trigger error on empty submit
timkimadobe Oct 31, 2024
6bb8b95
Update to latest version of reusable workflow format
timkimadobe Oct 31, 2024
768a412
Apply testing config
timkimadobe Oct 31, 2024
4cbe66c
Update input descriptions
timkimadobe Oct 31, 2024
678b39b
Update to production tag
timkimadobe Nov 8, 2024
3f25594
Update to final production config
timkimadobe Nov 8, 2024
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
75 changes: 21 additions & 54 deletions .github/workflows/maven-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,62 +15,29 @@ on:
workflow_dispatch:
inputs:
tag:
description: 'tag/version'
description: 'The existing tag (version) to be released (ex: 5.0.1).'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tag will be created with the workflow, so "The existing tag ..." might sound confusing.

Copy link
Contributor Author

@timkimadobe timkimadobe Oct 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The release workflow is currently using the --verify-tag flag which:

Abort in case the git tag doesn't already exist in the remote repository
docs: https://cli.github.com/manual/gh_release_create

This is true for both iOS and Android release workflows - I was thinking it could be beneficial to make creating the release tag explicit, in order to avoid accidentally publishing unintended changes/branch states. What do you think?

See example release failure due to missing tag + this flag here: https://github.com/timkimadobe/aepsdk-edge-android/actions/runs/11507608386/job/32034124666

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was under the impression create GH release creates the tag and release. Isn't that the case?

required: true

action_tag:
description: 'Create tag? ("no" to skip)'
create-github-release:
description: 'Create GitHub release with tag? ("false" to skip)'
type: boolean
required: true
default: 'yes'
default: true

edge-identity-dependency:
description: 'The AEPEdgeIdentity dependency version in gradle.properties to be validated (ex: 3.0.1).'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Here we use ex: 3.0.1 the L18 tag has ex: 5.0.1

let's keep example versions also consistent and probably to latest major version i.e. 3.x

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see 3.0.1 in rest of the PR so let's use 3.0.1 everywhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually what do you think about using a generic 1.2.3 everywhere instead?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

works

required: true
type: string
default: ''
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 17

- name: Cache Gradle packages
uses: actions/cache@v2
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle

- name: Verify version
run: |
set -eo pipefail
echo Release version: ${{ github.event.inputs.tag }}
(./scripts/version.sh -v ${{ github.event.inputs.tag }})

- name: Create GH Release
id: create_release
uses: release-drafter/release-drafter@v5
if: ${{ github.event.inputs.action_tag == 'yes' }}
with:
name: v${{ github.event.inputs.tag }}
tag: v${{ github.event.inputs.tag }}
version: v${{ github.event.inputs.tag }}
publish: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Import GPG key
env:
GPG_SECRET_KEYS: ${{ secrets.GPG_SECRET_KEYS }}
GPG_OWNERTRUST: ${{ secrets.GPG_OWNERTRUST }}
run: |
echo $GPG_SECRET_KEYS | base64 --decode | gpg --import --no-tty --batch --yes
echo $GPG_OWNERTRUST | base64 --decode | gpg --import-ownertrust --no-tty --batch --yes

- name: Publish to Maven Central Repository
run: make ci-publish
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
permissions:
contents: write
uses: adobe/aepsdk-commons/.github/workflows/android-maven-release.yml@gha-android-1.0.0
with:
tag: ${{ github.event.inputs.tag }}
create-github-release: ${{ github.event.inputs.create-github-release == 'true' }}
version-verify-paths: code/gradle.properties, code/edge/src/main/java/com/adobe/marketing/mobile/EdgeConstants.java
version-verify-dependencies: AEPEdgeIdentity ${{ github.event.inputs.edge-identity-dependency }}
workflow_tag: gha-android-1.0.0
secrets: inherit
36 changes: 5 additions & 31 deletions .github/workflows/maven-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,38 +11,12 @@
#

name: Publish Snapshot
on:
on:
workflow_dispatch:

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 17
- name: Cache Gradle packages
uses: actions/cache@v2
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
- name: Import GPG key
env:
GPG_SECRET_KEYS: ${{ secrets.GPG_SECRET_KEYS }}
GPG_OWNERTRUST: ${{ secrets.GPG_OWNERTRUST }}
run: |
echo $GPG_SECRET_KEYS | base64 --decode | gpg --import --no-tty --batch --yes
echo $GPG_OWNERTRUST | base64 --decode | gpg --import-ownertrust --no-tty --batch --yes
- name: Publish to Maven Snapshot Repository
run: make ci-publish-staging
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}

permissions:
contents: write
uses: adobe/aepsdk-commons/.github/workflows/android-maven-snapshot.yml@gha-android-1.0.0
secrets: inherit
76 changes: 41 additions & 35 deletions .github/workflows/update-version.yml
Original file line number Diff line number Diff line change
@@ -1,48 +1,54 @@
#
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep the copyright header for this file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! Added back

# Copyright 2024 Adobe. All rights reserved.
# This file is licensed to you under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. You may obtain a copy
# of the License at http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under
# the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
# OF ANY KIND, either express or implied. See the License for the specific language
# governing permissions and limitations under the License.
#
name: Update Versions

name: Update Version
on:
workflow_dispatch:
inputs:
version:
description: 'New version to use for the Edge extension. Example: 3.0.0'
version:
description: 'New version to use for the extension (ex: 3.0.1).'
required: true
type: string
default: ''

branch:
description: 'The target branch where the version update will be applied and the pull request will be merged into.'
required: true
type: string
default: ''

core-dependency:
description: '[Optional] Update Core dependency in pom.xml. Example: 3.0.0'
description: 'If a version is provided, update AEPCore dependency in gradle.properties (ex: 3.0.1).'
required: false
type: string
default: ''

identity-dependency:
description: '[Optional] Update Edge Identity dependency in pom.xml. Example: 3.0.0'
edge-identity-dependency:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Specify that this is a dependency in the pom.xm file, so users know this is a publish dependency.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

description: 'If a version is provided, update AEPEdgeIdentity dependency in gradle.properties (ex: 3.0.1).'
required: false
type: string
default: ''

jobs:
update-version:
runs-on: ubuntu-latest
edge-consent-dependency:
description: 'If a version is provided, update AEPEdgeConsent dependency in gradle.properties (ex: 3.0.1).'
required: false
type: string
default: ''

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Update Edge
run: (./scripts/version.sh -u -v ${{ github.event.inputs.version }} -d "Core ${{ github.event.inputs.core-dependency }}, EdgeIdentity ${{ github.event.inputs.identity-dependency }}")
testutils-dependency:
description: 'If a version is provided, update AEPTestUtils dependency in gradle.properties (ex: 3.0.1).'
required: false
type: string
default: ''

- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
token: ${{ github.token }}
commit-message: Updating version to ${{ github.event.inputs.version }}.
branch: version-${{ github.event.inputs.version }}-update
delete-branch: true
title: Updating version to ${{ github.event.inputs.version }}
body: Updating version to ${{ github.event.inputs.version }}
jobs:
update-versions:
permissions:
contents: write
pull-requests: write
uses: adobe/aepsdk-commons/.github/workflows/versions.yml@version-script-update
with:
version: ${{ github.event.inputs.version }}
branch: ${{ github.event.inputs.branch }}
dependencies: AEPCore ${{ github.event.inputs.core-dependency }}, AEPEdgeIdentity ${{ github.event.inputs.edge-identity-dependency }}, AEPEdgeConsent ${{ github.event.inputs.edge-consent-dependency }}, AEPTestUtils ${{ github.event.inputs.testutils-dependency }}
cacheung marked this conversation as resolved.
Show resolved Hide resolved
paths: code/edge/src/main/java/com/adobe/marketing/mobile/EdgeConstants.java, code/gradle.properties
update: true
workflow_tag: gha-android-1.0.0
cacheung marked this conversation as resolved.
Show resolved Hide resolved