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 iOS release reusable workflow - handle multi-extension repos #81

Merged
merged 14 commits into from
Oct 29, 2024

Conversation

timkimadobe
Copy link
Contributor

@timkimadobe timkimadobe commented Oct 23, 2024

Description

This PR updates the iOS release reusable workflow to be able to handle multi-extension repos with the main changes being:

  • Ability to specify:
    • A list of extensions to release (ex: "AEPServices, AEPCore")
    • A list of extension dependencies to release, which are not contained in the repo itself (ex: "AEPRulesEngine")
    • A list of extensions to publish to CocoaPods (ex: "AEPServices, AEPCore")

When not specifying any repos in the extensions to release, the script will still:

  • Run make check-version
  • Optionally publish pods, if that arg has been provided with valid values

Example job runs

Core iOS (multi-extension): https://github.com/timkimadobe/aepsdk-core-ios/actions/runs/11471135041/job/31921556669

  • NOTE: Job failure is due to missing CocoaPods secret token when running in fork (also don't want to publish as a test anyways)
  • Resulting GitHub release: https://github.com/timkimadobe/aepsdk-core-ios/releases/tag/5.3.1
    • Note the assets that are also included match what was specified in the job, with the proper names
    • NOTE: the auto-generated description for the release is empty, even though the workflow is configured to create this, and this is because it relies on PR descriptions but those are in the main repo, not in the fork.

Usage examples

Single extension repos can also use this workflow without too much friction:

name: Release

on:
  workflow_dispatch:
    inputs:
      tag:
        description: 'The tag (version) to be released (ex: 1.2.3).'
        type: string
        required: true
        default: ''

      create-github-release:
        description: 'Create a GitHub release with uploaded artifacts. If the provided `tag` does not exist, it will be created.'
        type: boolean
        required: true
        default: true

      pod-publish-extensions:
        description: 'Publish AEPEdge to Cocoapods.'
        type: boolean
        required: true
        default: true

jobs:
  release:
    uses: adobe/aepsdk-commons/.github/workflows/ios-release.yml@gha-ios-1.0.0
    with:
      tag: ${{ github.event.inputs.tag }}
      create-github-release: ${{ github.event.inputs.create-github-release == 'true' && 'AEPEdge' || '' }}
      pod-publish-extensions: ${{ github.event.inputs.pod-publish-extensions == 'true' && 'AEPEdge' || '' }}
    secrets: inherit

And multi-extension repos:

name: Release


on: 
  workflow_dispatch:
    inputs:
      tag:
        description: 'Existing tag (version) being released (ex: 5.0.1).'
        required: true
      # this is referring to releasing the extensions
      run_full_release:
        description: 'Run full release process: SPM and podspec validation, build artifacts, GH release (`false` to only check podspec version).'
        required: true
        default: true
        type: boolean

        # this section is referring to pods publishing
      release_AEPServices:
        description: 'Release AEPServices to Cocoapods (`false` to skip).'
        required: true
        default: true
        type: boolean
        
      release_AEPCore:
        description: 'Release AEPCore to Cocoapods (`false` to skip).'
        required: true
        default: true
        type: boolean
        
      release_AEPIdentity:
        description: 'Release AEPIdentity to Cocoapods (`false` to skip).'
        required: true
        default: true
        type: boolean
        
      release_AEPLifecycle:
        description: 'Release AEPLifecycle to Cocoapods (`false` to skip).'
        required: true
        default: true
        type: boolean
        
      release_AEPSignal:
        description: 'Release AEPSignal to Cocoapods (`false` to skip).'
        required: true
        default: true
        type: boolean

jobs:
  set-extensions:
    runs-on: ubuntu-latest
    outputs:
      full_release_extensions: ${{ steps.set-extensions.outputs.full_release_extensions }}
      pod_release_extensions: ${{ steps.set-extensions.outputs.pod_release_extensions }}
    steps:
      - name: Determine Extensions
        id: set-extensions
        run: |
          FULL_RELEASE_EXTENSIONS=""
          POD_RELEASE_EXTENSIONS=""

          # If run_full_release is true, add all extensions to full_release_extensions
          if [ "${{ github.event.inputs.run_full_release }}" == "true" ]; then
            FULL_RELEASE_EXTENSIONS="AEPServices,AEPCore,AEPIdentity,AEPLifecycle,AEPSignal"
          fi

          # Check each pod release input and build the pod_release_extensions string
          if [ "${{ github.event.inputs.release_AEPServices }}" == "true" ]; then
            POD_RELEASE_EXTENSIONS="${POD_RELEASE_EXTENSIONS},AEPServices"
          fi
          if [ "${{ github.event.inputs.release_AEPCore }}" == "true" ]; then
            POD_RELEASE_EXTENSIONS="${POD_RELEASE_EXTENSIONS},AEPCore"
          fi
          if [ "${{ github.event.inputs.release_AEPIdentity }}" == "true" ]; then
            POD_RELEASE_EXTENSIONS="${POD_RELEASE_EXTENSIONS},AEPIdentity"
          fi
          if [ "${{ github.event.inputs.release_AEPLifecycle }}" == "true" ]; then
            POD_RELEASE_EXTENSIONS="${POD_RELEASE_EXTENSIONS},AEPLifecycle"
          fi
          if [ "${{ github.event.inputs.release_AEPSignal }}" == "true" ]; then
            POD_RELEASE_EXTENSIONS="${POD_RELEASE_EXTENSIONS},AEPSignal"
          fi

          # Remove leading comma, if present
          POD_RELEASE_EXTENSIONS="${POD_RELEASE_EXTENSIONS#,}"

          # Output the variables to be used in the next job
          echo "full_release_extensions=$FULL_RELEASE_EXTENSIONS" >> $GITHUB_OUTPUT
          echo "pod_release_extensions=$POD_RELEASE_EXTENSIONS" >> $GITHUB_OUTPUT

  release:
    needs: set-extensions
    uses: timkimadobe/aepsdk-commons/.github/workflows/ios-release.yml@release-script-update
    with:
      tag: ${{ github.event.inputs.tag }}
      create-github-release: ${{ needs.set-extensions.outputs.full_release_extensions }}
      release-dependency-frameworks: AEPRulesEngine
      pod-publish-extensions: ${{ needs.set-extensions.outputs.pod_release_extensions }}
    secrets: inherit

Related Issue

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

type: string
full_release_extensions:
description: |
A comma-separated list of extensions for which to run the full release process.
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you clarify that this will only create a GitHub tag and attach XCFrameworks?

Copy link
Contributor Author

@timkimadobe timkimadobe Oct 28, 2024

Choose a reason for hiding this comment

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

Currently the workflow will not create a release if the tag does not already exist - this is because of the flag --verify-tag in the gh release create command. Please see: adobe/aepsdk-edge-android#171 (comment)

Is creating the tag if it doesn't exist preferred?

And I will also update the description to capture the points you mentioned!

Copy link
Contributor

@praveek praveek Oct 28, 2024

Choose a reason for hiding this comment

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

Yes. The tag should be created as part of release process.

I wanted the description to clarify that even though it says full release process, it will just create a GH release and not publish the pods.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok thank you! Updated to remove the --verify-tag flag in order to create tag if it doesnt exist on release. Also renamed full_release_extensions -> create-github-release and updated the description to hopefully be more clear about its effects

description: 'iOS Test App Scheme (ex: TestAppiOS)'
required: true
extension_dependencies:
description: |
Copy link
Contributor

@praveek praveek Oct 28, 2024

Choose a reason for hiding this comment

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

I would prefer a better name for this. Can you also clarify the description, as this is a Core-only requirement (since we bundle AEPRulesEngine xcframeworks as part of Core releases) and other extensions shouldn’t use it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Renamed extension_dependencies -> release-dependency-frameworks and updated the description to be more explicit about core-only requirement

…n release

Rename workflow inputs to better describe their purpose
Reorder input options for consistency
Update input descriptions to better describe their purpose and usage
@timkimadobe timkimadobe requested a review from praveek October 29, 2024 04:33
@praveek
Copy link
Contributor

praveek commented Oct 29, 2024

Looks good, can you also update the Core usage example in the description as the variable names don't match the latest implementation.

@timkimadobe timkimadobe merged commit 50147a0 into adobe:main Oct 29, 2024
2 checks passed
@timkimadobe timkimadobe deleted the release-script-update2 branch October 29, 2024 22:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants