From c9a7d1ed3eaf780ad4ba2a64f839457f379e258a Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Wed, 29 Jan 2025 14:09:54 +0100 Subject: [PATCH 01/21] restoring compatibility tests --- .github/workflows/build.yml | 110 ++++++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000000..f644277edd --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,110 @@ +name: Compatibility Test + +on: + workflow_dispatch: + push: + branches: + - develop + - release/** + +jobs: + tests: + runs-on: ${{ matrix.os }} + continue-on-error: false + strategy: + fail-fast: false + matrix: + include: + + - version: '17.2' + runtime: 'iOS-17-2' + device: 'iPhone 15' + displayname: 'iPhone-15' + os: 'macos-14-xlarge' + xcode_version: '15.1' + needs_custom_sim: false # Takes the shipped simulator that comes with Xcode 15 + + - version: '17.2' + runtime: 'iOS-17-2' + device: 'iPad Air (5th generation)' + displayname: 'iPad-Air-5' + os: 'macos-14-xlarge' + xcode_version: '15.1' + needs_custom_sim: false # Takes the shipped simulator that comes with Xcode 15 + + - version: '16.4' + runtime: 'iOS-16-4' + device: 'iPhone 14' + displayname: 'iPhone-14' + os: 'macos-13' + xcode_version: '14.3' + needs_custom_sim: false # Takes the shipped simulator that comes with Xcode 14 + + # Github deprecated macos-12 runners + # so we have to find another solution to test on older iOS versions + # + # - version: '15.0' + # runtime: 'iOS-15-0' + # device: 'iPhone 13' + # displayname: 'iPhone-13' + # os: 'macos-12-xl' + # needs_custom_sim: true + # + # - version: '14.2' + # device: 'iPhone 12' + # displayname: 'iPhone-12' + # runtime: 'iOS-14-2' + # os: 'macos-12-xl' + # needs_custom_sim: true + # + # - version: '13.7' + # runtime: 'iOS-13-7' + # device: 'iPhone 11' + # displayname: 'iPhone-11' + # os: 'macos-12-xl' + # needs_custom_sim: true + + steps: + - uses: actions/checkout@v4 + - uses: n1hility/cancel-previous-runs@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Prepare custom devices + run: | + sudo mkdir -p /Library/Developer/CoreSimulator/Profiles/Runtimes + + - name: Select Xcode ${{ matrix.xcode_version }} + if: matrix.xcode_version != '' + run: | + ls /Applications/Xcode_*.app + sudo xcode-select -s /Applications/Xcode_${xcode_version}.app/Contents/Developer + env: + xcode_version: ${{ matrix.xcode_version }} + + - name: Download simulator if needed (${{ matrix.version }}) + if: matrix.needs_custom_sim + run: | + xcversion simulators --install="iOS ${version}" + env: + version: ${{ matrix.version }} + + - name: Create simulator ${{ matrix.version }} + run: | + xcrun simctl list devices ${version} + xcrun simctl create ${displayname} "${device}" "com.apple.CoreSimulator.SimRuntime.${runtime}" + env: + version: ${{ matrix.version }} + displayname: ${{ matrix.displayname }} + device: ${{ matrix.device }} + runtime: ${{ matrix.runtime }} + + - name: Build and test + run: | + xcodebuild -version + xcodebuild build test -project ${project} -scheme "${scheme}" ${params} -destination "${destination}" ## | xcpretty --utf --color && exit ${PIPESTATUS[0]} + env: + project: 'Adyen.xcodeproj' + params: "-skipPackagePluginValidation" + scheme: 'IntegrationUIKitTests' + destination: "OS=${{ matrix.version }},name=${{ matrix.displayname }}" From 599ca7ea355f1c6f58f8e1bf912db27114583592 Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Wed, 29 Jan 2025 14:36:37 +0100 Subject: [PATCH 02/21] fix carthage tests --- Scripts/test-carthage-integration.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Scripts/test-carthage-integration.sh b/Scripts/test-carthage-integration.sh index 94b41684e8..f4810cdbab 100755 --- a/Scripts/test-carthage-integration.sh +++ b/Scripts/test-carthage-integration.sh @@ -160,7 +160,7 @@ cp "../Demo/Configuration.swift" Source/Configuration.swift xcodegen generate echo_header "Run Tests" -xcodebuild build test -project $PROJECT_NAME.xcodeproj -scheme App -destination "name=iPhone 15" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO | xcpretty && exit ${PIPESTATUS[0]} +xcodebuild build test -project $PROJECT_NAME.xcodeproj -scheme App -destination "name=iPhone 16" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO | xcpretty && exit ${PIPESTATUS[0]} if [ "$NEED_CLEANUP" == true ] then From faacbb0c84e95f92ee52807f0d96abd400db2a88 Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Wed, 29 Jan 2025 15:39:06 +0100 Subject: [PATCH 03/21] renamed build.yml to test-compatibility.yml --- .../workflows/{build.yml => verify-older-os-compatibility.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{build.yml => verify-older-os-compatibility.yml} (100%) diff --git a/.github/workflows/build.yml b/.github/workflows/verify-older-os-compatibility.yml similarity index 100% rename from .github/workflows/build.yml rename to .github/workflows/verify-older-os-compatibility.yml From 840ee1b778a062a9bdb71f14dff928f685a0fee9 Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Wed, 29 Jan 2025 16:04:05 +0100 Subject: [PATCH 04/21] Adding create_release workflow --- .github/workflows/create_release.yml | 32 ++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/create_release.yml diff --git a/.github/workflows/create_release.yml b/.github/workflows/create_release.yml new file mode 100644 index 0000000000..479f529786 --- /dev/null +++ b/.github/workflows/create_release.yml @@ -0,0 +1,32 @@ +name: Pull Request Merge + +on: + pull_request: + types: [closed] + branches: + - 'release/*' + +jobs: + create_release: + if: github.event.pull_request.merged == true + name: "Create Release" + runs-on: ubuntu-latest + + steps: + # Checking out the current branch + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + # Getting the description for the pull request that was merged + - name: Fetch Pull Request Description + run: | + PR_NUMBER=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH") + PR_DESCRIPTION=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + https://api.github.com/repos/${{ github.repository }}/pulls/${PR_NUMBER} | jq --raw-output .body) + echo "PR_DESCRIPTION=$PR_DESCRIPTION" >> $GITHUB_ENV + + - name: Create Release + run: | + echo "Creating Release for Version: XXX" + echo "Description: ${{ env.PR_DESCRIPTION }}" From 44492ae0bb8a6dce4d87a99c7a8d78f5cb31f586 Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Wed, 29 Jan 2025 16:05:28 +0100 Subject: [PATCH 05/21] tiny change --- .github/workflows/create_release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create_release.yml b/.github/workflows/create_release.yml index 479f529786..310c3f1075 100644 --- a/.github/workflows/create_release.yml +++ b/.github/workflows/create_release.yml @@ -28,5 +28,5 @@ jobs: - name: Create Release run: | - echo "Creating Release for Version: XXX" + echo "Creating Release for Version: ???" echo "Description: ${{ env.PR_DESCRIPTION }}" From 0f64317a08f3d8f5d50b2693c4b3dc47c1326ba1 Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Wed, 29 Jan 2025 16:17:47 +0100 Subject: [PATCH 06/21] trying out some things --- .github/workflows/create_release.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/create_release.yml b/.github/workflows/create_release.yml index 310c3f1075..a0c9867c56 100644 --- a/.github/workflows/create_release.yml +++ b/.github/workflows/create_release.yml @@ -3,8 +3,6 @@ name: Pull Request Merge on: pull_request: types: [closed] - branches: - - 'release/*' jobs: create_release: @@ -21,11 +19,18 @@ jobs: # Getting the description for the pull request that was merged - name: Fetch Pull Request Description run: | + SOURCE_BRANCH=$(jq --raw-output .pull_request.head.ref "$GITHUB_EVENT_PATH") + if [[ "$SOURCE_BRANCH" != release/* ]]; then + echo "Source branch does not match pattern. Exiting." + else + echo "Source branch is 'release/*'" + fi + PR_NUMBER=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH") PR_DESCRIPTION=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ https://api.github.com/repos/${{ github.repository }}/pulls/${PR_NUMBER} | jq --raw-output .body) echo "PR_DESCRIPTION=$PR_DESCRIPTION" >> $GITHUB_ENV - + - name: Create Release run: | echo "Creating Release for Version: ???" From b1a3483965e6faf820d8d908dfd9ca4221ff3a2d Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Wed, 29 Jan 2025 16:26:50 +0100 Subject: [PATCH 07/21] trying some things --- .github/workflows/create_release.yml | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/.github/workflows/create_release.yml b/.github/workflows/create_release.yml index a0c9867c56..64f12865ec 100644 --- a/.github/workflows/create_release.yml +++ b/.github/workflows/create_release.yml @@ -17,21 +17,34 @@ jobs: fetch-depth: 0 # Getting the description for the pull request that was merged - - name: Fetch Pull Request Description + - name: Fetch Pull Request Details run: | SOURCE_BRANCH=$(jq --raw-output .pull_request.head.ref "$GITHUB_EVENT_PATH") if [[ "$SOURCE_BRANCH" != release/* ]]; then echo "Source branch does not match pattern. Exiting." else - echo "Source branch is 'release/*'" + echo "Source branch was 'release/*'" fi + MERGE_COMMIT_SHA=$(jq --raw-output .pull_request.merge_commit_sha "$GITHUB_EVENT_PATH") + echo "MERGE_COMMIT_SHA=$MERGE_COMMIT_SHA" >> $GITHUB_ENV + PR_NUMBER=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH") PR_DESCRIPTION=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ https://api.github.com/repos/${{ github.repository }}/pulls/${PR_NUMBER} | jq --raw-output .body) - echo "PR_DESCRIPTION=$PR_DESCRIPTION" >> $GITHUB_ENV + echo "$PR_DESCRIPTION" >> "${{ github.workspace }}/release_notes.md" - name: Create Release run: | echo "Creating Release for Version: ???" echo "Description: ${{ env.PR_DESCRIPTION }}" + echo "The merge commit is: ${{ env.MERGE_COMMIT_SHA }}" + + # - name: Draft Release + # uses: softprops/action-gh-release@v2 + # with: + # body_path: "${{ github.workspace }}/release_notes.md" + # draft: true + # target_commitish: "develop" # Needs to be replaced by the merge commit of the PR + # tag_name: "X.X.X" + # token: ${{ secrets.GITHUB_TOKEN }} From c79895d23b40a8d69f69c30c4342420717786769 Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Wed, 29 Jan 2025 16:31:27 +0100 Subject: [PATCH 08/21] debugging --- .github/workflows/create_release.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/create_release.yml b/.github/workflows/create_release.yml index 64f12865ec..6704042e13 100644 --- a/.github/workflows/create_release.yml +++ b/.github/workflows/create_release.yml @@ -30,8 +30,14 @@ jobs: echo "MERGE_COMMIT_SHA=$MERGE_COMMIT_SHA" >> $GITHUB_ENV PR_NUMBER=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH") - PR_DESCRIPTION=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ - https://api.github.com/repos/${{ github.repository }}/pulls/${PR_NUMBER} | jq --raw-output .body) + echo "PR Number: $PR_NUMBER" + + CURL_OUTPUT=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ github.repository }}/pulls/${PR_NUMBER}) + echo "CURL Output: $CURL_OUTPUT" + + PR_DESCRIPTION=$(jq --raw-output .body "$CURL_OUTPUT") + echo "PR Description: $PR_DESCRIPTION" + echo "$PR_DESCRIPTION" >> "${{ github.workspace }}/release_notes.md" - name: Create Release From fea4781069ec44ce0ad2a202300377236bfdf1f8 Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Wed, 29 Jan 2025 16:34:45 +0100 Subject: [PATCH 09/21] test --- .github/workflows/create_release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create_release.yml b/.github/workflows/create_release.yml index 6704042e13..f137bbe936 100644 --- a/.github/workflows/create_release.yml +++ b/.github/workflows/create_release.yml @@ -35,7 +35,7 @@ jobs: CURL_OUTPUT=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ github.repository }}/pulls/${PR_NUMBER}) echo "CURL Output: $CURL_OUTPUT" - PR_DESCRIPTION=$(jq --raw-output .body "$CURL_OUTPUT") + PR_DESCRIPTION=$($CURL_OUTPUT | jq --raw-output .body) echo "PR Description: $PR_DESCRIPTION" echo "$PR_DESCRIPTION" >> "${{ github.workspace }}/release_notes.md" From af88c4987d385adbea802fa790d8c60c505c826c Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Wed, 29 Jan 2025 16:38:32 +0100 Subject: [PATCH 10/21] maybe this works --- .github/workflows/create_release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create_release.yml b/.github/workflows/create_release.yml index f137bbe936..58a730ebfa 100644 --- a/.github/workflows/create_release.yml +++ b/.github/workflows/create_release.yml @@ -35,7 +35,7 @@ jobs: CURL_OUTPUT=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ github.repository }}/pulls/${PR_NUMBER}) echo "CURL Output: $CURL_OUTPUT" - PR_DESCRIPTION=$($CURL_OUTPUT | jq --raw-output .body) + PR_DESCRIPTION=$("$CURL_OUTPUT" | jq --raw-output .body) echo "PR Description: $PR_DESCRIPTION" echo "$PR_DESCRIPTION" >> "${{ github.workspace }}/release_notes.md" From 8a24f8fc3218f78c92fd9e1a5db8ac972f9a481b Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Wed, 29 Jan 2025 16:43:04 +0100 Subject: [PATCH 11/21] =?UTF-8?q?let=E2=80=99s=20try=20this?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/create_release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/create_release.yml b/.github/workflows/create_release.yml index 58a730ebfa..fd839337c9 100644 --- a/.github/workflows/create_release.yml +++ b/.github/workflows/create_release.yml @@ -1,4 +1,4 @@ -name: Pull Request Merge +name: "🚀 Release on merge" on: pull_request: @@ -35,7 +35,7 @@ jobs: CURL_OUTPUT=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ github.repository }}/pulls/${PR_NUMBER}) echo "CURL Output: $CURL_OUTPUT" - PR_DESCRIPTION=$("$CURL_OUTPUT" | jq --raw-output .body) + PR_DESCRIPTION=$(jq --raw-output .body <<< "$CURL_OUTPUT") echo "PR Description: $PR_DESCRIPTION" echo "$PR_DESCRIPTION" >> "${{ github.workspace }}/release_notes.md" From 81ea28410eb2eb3951d536b7e962425c6d567dfd Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Wed, 29 Jan 2025 16:48:30 +0100 Subject: [PATCH 12/21] trying to get version number --- .github/workflows/create_release.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/create_release.yml b/.github/workflows/create_release.yml index fd839337c9..c3d2caf289 100644 --- a/.github/workflows/create_release.yml +++ b/.github/workflows/create_release.yml @@ -26,6 +26,9 @@ jobs: echo "Source branch was 'release/*'" fi + VERSION_NUMBER=${SOURCE_BRANCH#release/} + echo "VERSION_NUMBER=$VERSION_NUMBER" >> $GITHUB_ENV + MERGE_COMMIT_SHA=$(jq --raw-output .pull_request.merge_commit_sha "$GITHUB_EVENT_PATH") echo "MERGE_COMMIT_SHA=$MERGE_COMMIT_SHA" >> $GITHUB_ENV @@ -42,8 +45,9 @@ jobs: - name: Create Release run: | - echo "Creating Release for Version: ???" - echo "Description: ${{ env.PR_DESCRIPTION }}" + echo "Creating Release for Version: ${{ env.VERSION_NUMBER }}" + echo "Description:" + cat "${{ github.workspace }}/release_notes.md" echo "The merge commit is: ${{ env.MERGE_COMMIT_SHA }}" # - name: Draft Release From 9d15552d89ae8b24a59ed442d489f8afe03cfe04 Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Wed, 29 Jan 2025 16:53:39 +0100 Subject: [PATCH 13/21] does this work? --- .github/workflows/create_release.yml | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/.github/workflows/create_release.yml b/.github/workflows/create_release.yml index c3d2caf289..8f66d29d9e 100644 --- a/.github/workflows/create_release.yml +++ b/.github/workflows/create_release.yml @@ -22,11 +22,16 @@ jobs: SOURCE_BRANCH=$(jq --raw-output .pull_request.head.ref "$GITHUB_EVENT_PATH") if [[ "$SOURCE_BRANCH" != release/* ]]; then echo "Source branch does not match pattern. Exiting." - else - echo "Source branch was 'release/*'" + exit 1 fi VERSION_NUMBER=${SOURCE_BRANCH#release/} + if [[ ! "$VERSION_NUMBER" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + echo "SUFFIX does not match semantic versioning format. Exiting." + exit 1 + fi + + echo "SOURCE_BRANCH=$SOURCE_BRANCH" >> $GITHUB_ENV echo "VERSION_NUMBER=$VERSION_NUMBER" >> $GITHUB_ENV MERGE_COMMIT_SHA=$(jq --raw-output .pull_request.merge_commit_sha "$GITHUB_EVENT_PATH") @@ -50,11 +55,11 @@ jobs: cat "${{ github.workspace }}/release_notes.md" echo "The merge commit is: ${{ env.MERGE_COMMIT_SHA }}" - # - name: Draft Release - # uses: softprops/action-gh-release@v2 - # with: - # body_path: "${{ github.workspace }}/release_notes.md" - # draft: true - # target_commitish: "develop" # Needs to be replaced by the merge commit of the PR - # tag_name: "X.X.X" - # token: ${{ secrets.GITHUB_TOKEN }} + - name: Draft Release + uses: softprops/action-gh-release@v2 + with: + body_path: "${{ github.workspace }}/release_notes.md" + draft: true + target_commitish: ${{ env.SOURCE_BRANCH }} + tag_name: ${{ env.VERSION_NUMBER }} + token: ${{ secrets.GITHUB_TOKEN }} From 7283768b394fd6deb3178d22688c2c5229671d4d Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Wed, 29 Jan 2025 16:56:11 +0100 Subject: [PATCH 14/21] small change --- .github/workflows/create_release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create_release.yml b/.github/workflows/create_release.yml index 8f66d29d9e..968b17707d 100644 --- a/.github/workflows/create_release.yml +++ b/.github/workflows/create_release.yml @@ -48,7 +48,7 @@ jobs: echo "$PR_DESCRIPTION" >> "${{ github.workspace }}/release_notes.md" - - name: Create Release + - name: Release Info run: | echo "Creating Release for Version: ${{ env.VERSION_NUMBER }}" echo "Description:" From 084a8c98610f3ca36522b7c25f5a4bb58084bce6 Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Wed, 29 Jan 2025 16:59:32 +0100 Subject: [PATCH 15/21] fixing the commitish --- .github/workflows/create_release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create_release.yml b/.github/workflows/create_release.yml index 968b17707d..b6c45d48b0 100644 --- a/.github/workflows/create_release.yml +++ b/.github/workflows/create_release.yml @@ -60,6 +60,6 @@ jobs: with: body_path: "${{ github.workspace }}/release_notes.md" draft: true - target_commitish: ${{ env.SOURCE_BRANCH }} + target_commitish: ${{ env.MERGE_COMMIT_SHA }} tag_name: ${{ env.VERSION_NUMBER }} token: ${{ secrets.GITHUB_TOKEN }} From 3a5363e2e85f16f5328f588b99bbced8e05dcacd Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Wed, 29 Jan 2025 17:06:47 +0100 Subject: [PATCH 16/21] using release_body --- .github/workflows/create_release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/create_release.yml b/.github/workflows/create_release.yml index b6c45d48b0..3bbe5e9775 100644 --- a/.github/workflows/create_release.yml +++ b/.github/workflows/create_release.yml @@ -46,7 +46,7 @@ jobs: PR_DESCRIPTION=$(jq --raw-output .body <<< "$CURL_OUTPUT") echo "PR Description: $PR_DESCRIPTION" - echo "$PR_DESCRIPTION" >> "${{ github.workspace }}/release_notes.md" + echo "$PR_DESCRIPTION" >> "${{ github.workspace }}/release_body.md" - name: Release Info run: | @@ -58,7 +58,7 @@ jobs: - name: Draft Release uses: softprops/action-gh-release@v2 with: - body_path: "${{ github.workspace }}/release_notes.md" + body_path: "${{ github.workspace }}/release_body.md" draft: true target_commitish: ${{ env.MERGE_COMMIT_SHA }} tag_name: ${{ env.VERSION_NUMBER }} From 24956033bec5f3591232a6654e8f8855473f77ce Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Wed, 29 Jan 2025 17:10:07 +0100 Subject: [PATCH 17/21] Removing unneeded code --- .github/workflows/create_release.yml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/.github/workflows/create_release.yml b/.github/workflows/create_release.yml index 3bbe5e9775..fcbf33605b 100644 --- a/.github/workflows/create_release.yml +++ b/.github/workflows/create_release.yml @@ -48,14 +48,7 @@ jobs: echo "$PR_DESCRIPTION" >> "${{ github.workspace }}/release_body.md" - - name: Release Info - run: | - echo "Creating Release for Version: ${{ env.VERSION_NUMBER }}" - echo "Description:" - cat "${{ github.workspace }}/release_notes.md" - echo "The merge commit is: ${{ env.MERGE_COMMIT_SHA }}" - - - name: Draft Release + - name: Drafting Release uses: softprops/action-gh-release@v2 with: body_path: "${{ github.workspace }}/release_body.md" From d0d018f1b0989fc68c0ac171df294768186de9f6 Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Thu, 30 Jan 2025 12:10:49 +0100 Subject: [PATCH 18/21] simplifying script --- .github/workflows/create_release.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/create_release.yml b/.github/workflows/create_release.yml index fcbf33605b..affa5ceb1b 100644 --- a/.github/workflows/create_release.yml +++ b/.github/workflows/create_release.yml @@ -19,27 +19,28 @@ jobs: # Getting the description for the pull request that was merged - name: Fetch Pull Request Details run: | - SOURCE_BRANCH=$(jq --raw-output .pull_request.head.ref "$GITHUB_EVENT_PATH") + SOURCE_BRANCH=${{ github.event.pull_request.head.ref }} + + # Checking if the source branch was a release if [[ "$SOURCE_BRANCH" != release/* ]]; then echo "Source branch does not match pattern. Exiting." exit 1 fi + # Extracting the version number from the source branch name VERSION_NUMBER=${SOURCE_BRANCH#release/} if [[ ! "$VERSION_NUMBER" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then - echo "SUFFIX does not match semantic versioning format. Exiting." + echo "'$VERSION_NUMBER' does not match semantic versioning format. Exiting." exit 1 fi + MERGE_COMMIT_SHA=${{ github.event.pull_request.merge_commit_sha }} + PR_NUMBER=${{ github.event.pull_request.number }} + echo "SOURCE_BRANCH=$SOURCE_BRANCH" >> $GITHUB_ENV echo "VERSION_NUMBER=$VERSION_NUMBER" >> $GITHUB_ENV - - MERGE_COMMIT_SHA=$(jq --raw-output .pull_request.merge_commit_sha "$GITHUB_EVENT_PATH") echo "MERGE_COMMIT_SHA=$MERGE_COMMIT_SHA" >> $GITHUB_ENV - PR_NUMBER=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH") - echo "PR Number: $PR_NUMBER" - CURL_OUTPUT=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ github.repository }}/pulls/${PR_NUMBER}) echo "CURL Output: $CURL_OUTPUT" From 9ff8c664720a91064218a1c29f3c31407b2ffbb3 Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Thu, 30 Jan 2025 12:11:46 +0100 Subject: [PATCH 19/21] rename to create change --- .github/workflows/create_release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/create_release.yml b/.github/workflows/create_release.yml index affa5ceb1b..8fba656351 100644 --- a/.github/workflows/create_release.yml +++ b/.github/workflows/create_release.yml @@ -47,12 +47,12 @@ jobs: PR_DESCRIPTION=$(jq --raw-output .body <<< "$CURL_OUTPUT") echo "PR Description: $PR_DESCRIPTION" - echo "$PR_DESCRIPTION" >> "${{ github.workspace }}/release_body.md" + echo "$PR_DESCRIPTION" >> "${{ github.workspace }}/release_content.md" - name: Drafting Release uses: softprops/action-gh-release@v2 with: - body_path: "${{ github.workspace }}/release_body.md" + body_path: "${{ github.workspace }}/release_content.md" draft: true target_commitish: ${{ env.MERGE_COMMIT_SHA }} tag_name: ${{ env.VERSION_NUMBER }} From 94340c6cc72912921eb62168f2ff185ecbe8f275 Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Thu, 30 Jan 2025 12:16:06 +0100 Subject: [PATCH 20/21] some script refactoring --- .github/workflows/create_release.yml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/create_release.yml b/.github/workflows/create_release.yml index 8fba656351..2e3ba390c4 100644 --- a/.github/workflows/create_release.yml +++ b/.github/workflows/create_release.yml @@ -11,12 +11,10 @@ jobs: runs-on: ubuntu-latest steps: - # Checking out the current branch - uses: actions/checkout@v4 with: fetch-depth: 0 - # Getting the description for the pull request that was merged - name: Fetch Pull Request Details run: | SOURCE_BRANCH=${{ github.event.pull_request.head.ref }} @@ -41,15 +39,16 @@ jobs: echo "VERSION_NUMBER=$VERSION_NUMBER" >> $GITHUB_ENV echo "MERGE_COMMIT_SHA=$MERGE_COMMIT_SHA" >> $GITHUB_ENV - CURL_OUTPUT=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ github.repository }}/pulls/${PR_NUMBER}) - echo "CURL Output: $CURL_OUTPUT" + # Requesting the PR info + PR_INFO=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ github.repository }}/pulls/${PR_NUMBER}) - PR_DESCRIPTION=$(jq --raw-output .body <<< "$CURL_OUTPUT") - echo "PR Description: $PR_DESCRIPTION" + # Extracting the PR body from the PR info + PR_BODY=$(jq --raw-output .body <<< "$PR_INFO") + echo "PR Body: $PR_BODY" - echo "$PR_DESCRIPTION" >> "${{ github.workspace }}/release_content.md" + echo "$PR_BODY" >> "${{ github.workspace }}/release_content.md" - - name: Drafting Release + - name: Create Release uses: softprops/action-gh-release@v2 with: body_path: "${{ github.workspace }}/release_content.md" From 972fbe357f59612d38d9e9ad972b03d02594ab28 Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Thu, 30 Jan 2025 13:13:54 +0100 Subject: [PATCH 21/21] not running the label validation on release branches --- .github/workflows/validate_pr_labels_and_release_notes.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/validate_pr_labels_and_release_notes.yml b/.github/workflows/validate_pr_labels_and_release_notes.yml index 34af5f74bc..637040c4c1 100644 --- a/.github/workflows/validate_pr_labels_and_release_notes.yml +++ b/.github/workflows/validate_pr_labels_and_release_notes.yml @@ -6,6 +6,7 @@ on: jobs: get-pr-labels: + if: "!startsWith(github.event.pull_request.head.ref, 'release/')" runs-on: ubuntu-latest steps: - name: Fetch repo