From a95306f94a155ab268f6b3c1deaaf4e742c9dc72 Mon Sep 17 00:00:00 2001 From: Roland Kakonyi Date: Fri, 20 Oct 2023 15:26:56 +0200 Subject: [PATCH 1/8] chore: utilize cocoapods cache for building the release --- .github/workflows/start-release-train.yml | 29 +++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/.github/workflows/start-release-train.yml b/.github/workflows/start-release-train.yml index f9cb9c39..f6200541 100644 --- a/.github/workflows/start-release-train.yml +++ b/.github/workflows/start-release-train.yml @@ -58,9 +58,34 @@ jobs: run: | yarn version --new-version ${{ inputs.version_number }} --no-git-tag-version - - name: Update Podfile.lock + - name: Restore Pods cache + id: pods-cache-restore + uses: actions/cache/restore@v3 + with: + path: | + .cocoapods-cache + example/ios/Pods + key: pods-${{ hashFiles('example/ios/Podfile.lock') }} + restore-keys: pods- + + - name: Install pods to update Podfile.lock run: | - yarn bootstrap + pod repo remove trunk + pod repo add bitmovin https://github.com/bitmovin/cocoapod-specs.git || pod repo update bitmovin + pod install --repo-update + working-directory: example/ios + env: + CP_HOME_DIR: ${{ github.workspace }}/.cocoapods-cache + NO_FLIPPER: 1 + + - name: Save Pods cache + if: steps.pods-cache-restore.outputs.cache-hit != 'true' + uses: actions/cache/save@v3 + with: + path: | + .cocoapods-cache + example/ios/Pods + key: ${{ steps.pods-cache-restore.outputs.cache-primary-key }} - name: Commit changelog version bump run: | From d3285c9d099ec12b4dbb39a1aec3013c463a9ac5 Mon Sep 17 00:00:00 2001 From: Roland Kakonyi Date: Fri, 20 Oct 2023 15:29:26 +0200 Subject: [PATCH 2/8] chore: ask review from the user triggering the action on the release PR --- .github/workflows/start-release-train.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/start-release-train.yml b/.github/workflows/start-release-train.yml index f6200541..2136e90d 100644 --- a/.github/workflows/start-release-train.yml +++ b/.github/workflows/start-release-train.yml @@ -98,6 +98,7 @@ jobs: gh pr create \ --base "main" \ --title "Release ${{ inputs.version_number }}" \ - --body "Release ${{ inputs.version_number }}" + --body "Release ${{ inputs.version_number }}.\n\nPlease review and merge this PR to continue the release process." \ + --reviewer "${{ github.actor}}" env: GH_TOKEN: ${{ github.token }} From e0a386cf331870cbbb0090230196c2ab025f5383 Mon Sep 17 00:00:00 2001 From: Roland Kakonyi Date: Fri, 20 Oct 2023 15:29:44 +0200 Subject: [PATCH 3/8] chore: add dry run mode for testing --- .github/workflows/start-release-train.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/start-release-train.yml b/.github/workflows/start-release-train.yml index 2136e90d..bc291fca 100644 --- a/.github/workflows/start-release-train.yml +++ b/.github/workflows/start-release-train.yml @@ -10,6 +10,11 @@ on: description: 'Date of the final release. Will be used for CHANGELOG.md (format YYYY-MM-DD, e.g. 2023-02-27)' type: string required: true + dry_run: + description: 'If true, the workflow will not create a PR' + type: boolean + required: false + default: false env: LC_ALL: en_US.UTF-8 LANG: en_US.UTF-8 @@ -45,6 +50,7 @@ jobs: echo "branch_name=$branch_name" >> $GITHUB_OUTPUT - name: Create Release Branch + if: ${{ !inputs.dry_run }} run: | # Delete the release branch if already exists, useful in case we need to re-run this workflow git push origin --delete ${{ steps.branching.outputs.branch_name }} || true @@ -53,10 +59,12 @@ jobs: - name: Bump changelog version run: | sed -i'.bak' "s/\[Unreleased\]/\[${{ inputs.version_number }}\] \(${{ inputs.release_date }}\)/g" CHANGELOG.md + head -n 50 CHANGELOG.md - name: Bump package.json version run: | yarn version --new-version ${{ inputs.version_number }} --no-git-tag-version + jq --raw-output '.version' package.json - name: Restore Pods cache id: pods-cache-restore @@ -88,12 +96,14 @@ jobs: key: ${{ steps.pods-cache-restore.outputs.cache-primary-key }} - name: Commit changelog version bump + if: ${{ !inputs.dry_run }} run: | git add CHANGELOG.md package.json example/ios/Podfile.lock git commit -m "chore: prepare release ${{ inputs.version_number }}" git push origin ${{ steps.branching.outputs.branch_name }} - name: Create PR + if: ${{ !inputs.dry_run }} run: | gh pr create \ --base "main" \ From d61a4259d99f8879c0e759ef933cb18d75a8bb64 Mon Sep 17 00:00:00 2001 From: Roland Kakonyi Date: Fri, 20 Oct 2023 15:35:41 +0200 Subject: [PATCH 4/8] chore: print branch name during start release workflow --- .github/workflows/start-release-train.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/start-release-train.yml b/.github/workflows/start-release-train.yml index bc291fca..3027200a 100644 --- a/.github/workflows/start-release-train.yml +++ b/.github/workflows/start-release-train.yml @@ -48,6 +48,7 @@ jobs: run: | branch_name="release/v${{ inputs.version_number }}" echo "branch_name=$branch_name" >> $GITHUB_OUTPUT + echo "$branch_name" - name: Create Release Branch if: ${{ !inputs.dry_run }} From 4e3df8837f888ae2a97d3b4e61c512e440807252 Mon Sep 17 00:00:00 2001 From: Roland Kakonyi Date: Fri, 20 Oct 2023 15:41:28 +0200 Subject: [PATCH 5/8] chore: fix installing pods --- .github/workflows/start-release-train.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/start-release-train.yml b/.github/workflows/start-release-train.yml index 3027200a..8e4e6c90 100644 --- a/.github/workflows/start-release-train.yml +++ b/.github/workflows/start-release-train.yml @@ -77,14 +77,19 @@ jobs: key: pods-${{ hashFiles('example/ios/Podfile.lock') }} restore-keys: pods- - - name: Install pods to update Podfile.lock + - name: Set up CocoaPods run: | pod repo remove trunk pod repo add bitmovin https://github.com/bitmovin/cocoapod-specs.git || pod repo update bitmovin - pod install --repo-update working-directory: example/ios env: CP_HOME_DIR: ${{ github.workspace }}/.cocoapods-cache + + - name: Install pods to update Podfile.lock + run: | + yarn bootstrap + env: + CP_HOME_DIR: ${{ github.workspace }}/.cocoapods-cache NO_FLIPPER: 1 - name: Save Pods cache From 242c9af2926ac06b705eb1427e934b4cad3b1991 Mon Sep 17 00:00:00 2001 From: Roland Kakonyi Date: Fri, 20 Oct 2023 15:43:04 +0200 Subject: [PATCH 6/8] chore: remove manual package version print as it is printed already --- .github/workflows/start-release-train.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/start-release-train.yml b/.github/workflows/start-release-train.yml index 8e4e6c90..21d3adea 100644 --- a/.github/workflows/start-release-train.yml +++ b/.github/workflows/start-release-train.yml @@ -65,7 +65,6 @@ jobs: - name: Bump package.json version run: | yarn version --new-version ${{ inputs.version_number }} --no-git-tag-version - jq --raw-output '.version' package.json - name: Restore Pods cache id: pods-cache-restore From 9dba7211ad84dfee9f7ad16519510ef589f8c92f Mon Sep 17 00:00:00 2001 From: Roland Kakonyi Date: Fri, 20 Oct 2023 15:56:07 +0200 Subject: [PATCH 7/8] chore: improve printing changelog --- .github/workflows/start-release-train.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/start-release-train.yml b/.github/workflows/start-release-train.yml index 21d3adea..62f53151 100644 --- a/.github/workflows/start-release-train.yml +++ b/.github/workflows/start-release-train.yml @@ -60,7 +60,7 @@ jobs: - name: Bump changelog version run: | sed -i'.bak' "s/\[Unreleased\]/\[${{ inputs.version_number }}\] \(${{ inputs.release_date }}\)/g" CHANGELOG.md - head -n 50 CHANGELOG.md + awk 'BEGIN {count=0} /## \[/ {count++; if (count == 2) exit} {print}' CHANGELOG.md - name: Bump package.json version run: | From 0fbdcbc2830b99c6fef3a7b0187e459d172cab2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20K=C3=A1konyi?= Date: Tue, 12 Dec 2023 09:11:38 +0100 Subject: [PATCH 8/8] chore: add missing space for variable usage --- .github/workflows/start-release-train.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/start-release-train.yml b/.github/workflows/start-release-train.yml index 62f53151..37830df1 100644 --- a/.github/workflows/start-release-train.yml +++ b/.github/workflows/start-release-train.yml @@ -114,6 +114,6 @@ jobs: --base "main" \ --title "Release ${{ inputs.version_number }}" \ --body "Release ${{ inputs.version_number }}.\n\nPlease review and merge this PR to continue the release process." \ - --reviewer "${{ github.actor}}" + --reviewer "${{ github.actor }}" env: GH_TOKEN: ${{ github.token }}