-
Notifications
You must be signed in to change notification settings - Fork 7
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
Reusable workflow updates #94
Reusable workflow updates #94
Conversation
…tion Fix input descriptions Update logic to use explicit cache save and file removal instead of git add ignore
.github/workflows/versions.yml
Outdated
|
||
**Example:** | ||
iOS: `"AEPCore 3.1.1, AEPServices 8.9.10@AEPCore.podspec, Edge 3.2.1@Package.swift"` | ||
Android: `"AEPCore 7.8.9, AEPEdgeIdentity 8.9.10@code/gradle.properties"` | ||
Android: `"AEPCore 7.8.9, AEPEdgeIdentity 8.9.10@code/gradle.properties;code/example.kt"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we adding code/example.kt
is it also an intended sample? If yes we can call it code/constants.kt
for better context. If we want to add this let's add the sample for iOS as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can also give full samples like on L63
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! I updated them to be more realistic examples
.github/workflows/versions.yml
Outdated
path: .github/aepsdk-commons/scripts | ||
key: aepsdk-commons-${{ inputs.workflow_tag }} # Cache key format: <REPO_NAME>-<TAG> | ||
|
||
- name: Update or verify versions | ||
run: | | ||
UPDATE_FLAG="" | ||
if [ "${{ inputs.update }}" = "true" ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inputs.update can be treated as boolean here, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes! I actually simplified it further by just directly using a GitHub Actions ternary instead of using shell logic - what do you think?
Reorder input params for consistency
…call Update how tags are used for reusable workflows to be locally defined instead of passed
|
Update android release to use updated remote tag check
required: false | ||
default: '' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this default be removed as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this default should be ok, since the empty string case is taken as no dependencies being specified? Or were you referring to something else?
|
||
# This workflow requires the following GitHub repository settings: | ||
# 1. Navigate to: Settings -> Code and automation -> Actions -> General. | ||
# 2. Under "Workflow permissions," select: | ||
# - "Allow GitHub Actions to create and approve pull requests." | ||
|
||
env: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we not adding WORKFLOW_TAG to other workflows like release_ios, android etc..?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is because of where the value is used - for the uses:
field (used in ios-release.yml, for example), using dynamic values is not possible (ex: ${{ env.WORKFLOW_TAG }})
However, it does work in this case due to the context it is used in this workflow
Questions for reviewers
1. Tag strategy, given that we are hardcoding the tags inside the reusable workflows (in order to be able to nest reusable workflows). Some options:* Date based tag: gha-ios-2024.10.30 OR gha-2024.10.30 (without platform)
* Semantic version based tag: gha-ios-1.0.0
* Also can be matched to the major version of the extensions it applies to, like AEPTestUtils
Going with platform based major version aligned tag strategy (similar to AEPTestUtils):
gha-ios-5.0.0
gha-android-3.0.0
2. Should the release actions be allowed to rerun without failure if a GitHub release with the same tag already exists? This could be useful in cases where the action needs to be rerun, such as for an expired CocoaPods token.* Currently, the action fails if a GitHub release with the given tag already exists, which can happen if the release was created successfully in a previous run but failed afterward due to other issues.
Applying the following logic, where the release and publish pod steps are independent of each other (aside from the publish pod's check of tag existing):
Description
Important
This PR changes how tags are used within the reusable workflows. Before, the tags were passed to the workflows and now they are hardcoded to match the tag they will be released with.
This means that the tag maintenance burden is on the aepsdk-commons side and not the caller, and also enables us to more easily use nested reusable workflows.
This PR fixes the implementation of the reusable workflows:
versions.yml
andios-release.yml
, updated input var names inandroid-maven-release.yml
and updates documentation.ios-release.yml
Makefile
andversion.sh
. Replaced with usage of Commonsversion.py script
with associated cache + checkout logic.versions.yml
git add
exclusion for aepsdk-commons scriptspaths
beforedependencies
version-verify-paths
->version-validation-paths
for clarityversion-verify-dependencies
->version-validation-dependencies
for clarityText/doc related changes:
android-maven-release.yml
version-verify-paths
->version-validation-paths
for clarityversion-verify-dependencies
->version-validation-dependencies
for clarityversions.py
Updated documentation for consistency with changes in
versions.yml
workflows.md
Newly created documentation that covers requirements for reusable workflow usage
Example job runs
Using the fixed versions logic in iOS release:
Validate versions run:
Example of error output from version validation fail:
iOS Release with new chained version validation workflow
Android release with new chained version validation workflow
Android update versions example:
Alternative implementations
For the version validation logic used in the iOS and Android release workflows, I tried to simplify the amount of boilerplate steps surrounding cache, checkout, using the script, cleanup by exploring the alternatives:
Using Javascript workflow dispatch
This could work but is more cumbersome because a PAT is required since GITHUB_TOKEN auto-authorization for this kind of dispatch only works for
workflow_dispatch
andrepository_dispatch
events (our reusable workflows useworkflow_call
)github.rest.actions.createWorkflowDispatch
does not trigger a run actions/github-script#250github
instance is a wrapper around the octokit object, provided by github-scriptUsing composable action
This doesnt work for the same reason that the version.py script is not accessible from the context of the caller repo - if you want to use a composite action defined in aepsdk-commons you need to download the action definition somehow and you're back where you started.
Related Issue
Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: