From 56eefef5eca9bd13f861a8cc7476fe9607787ea4 Mon Sep 17 00:00:00 2001 From: Bryce Buchanan Date: Mon, 28 Oct 2024 12:53:40 -0700 Subject: [PATCH 01/14] updated podspec names in release.yml --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index da6a39cc..074bf670 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -29,8 +29,8 @@ jobs: ' > Sources/OpenTelemetrySdk/Version.swift - name: update Podspec run: | - sed -i -e 's/spec.version = ".*"/spec.version = "${{ inputs.new_version }}"/' OpenTelemetryApi.podspec - sed -i -e 's/spec.version = ".*"/spec.version = "${{ inputs.new_version }}"/' OpenTelemetrySdk.podspec + sed -i -e 's/spec.version = ".*"/spec.version = "${{ inputs.new_version }}"/' OpenTelemetry-Swift-Api.podspec + sed -i -e 's/spec.version = ".*"/spec.version = "${{ inputs.new_version }}"/' OpenTelemetry-Swift-Sdk.podspec - uses: stefanzweifel/git-auto-commit-action@v5 with: From 517711703f474660f79b55b67a044e542fc45fcc Mon Sep 17 00:00:00 2001 From: Bryce Buchanan Date: Mon, 28 Oct 2024 13:42:59 -0700 Subject: [PATCH 02/14] updated release action to create a PR --- .github/workflows/release.yml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 074bf670..c42447ff 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -32,13 +32,15 @@ jobs: sed -i -e 's/spec.version = ".*"/spec.version = "${{ inputs.new_version }}"/' OpenTelemetry-Swift-Api.podspec sed -i -e 's/spec.version = ".*"/spec.version = "${{ inputs.new_version }}"/' OpenTelemetry-Swift-Sdk.podspec - - uses: stefanzweifel/git-auto-commit-action@v5 + - name: Create Pull Request + uses: peter-evans/create-pull-request@v7 with: - commit_message: version bump to ${{inputs.new_version}} - tagging_message: 'v${{ inputs.new_version }}' - - uses: ncipollo/release-action@v1 - with: - tag: v${{inputs.new_version}} - prerelease: true - generateReleaseNotes: true + commit-message: 'Release v${{inputs.new_version}}' + title: 'Release v${{inputs.new_version}}' + body: > + This PR is auto-generated by + [create-pull-request](https://github.com/peter-evans/create-pull-request). + labels: release, automated pr + base: main + From 014c21bdbacb3c0c47c730e1509aec0c87796281 Mon Sep 17 00:00:00 2001 From: Bryce Buchanan Date: Mon, 28 Oct 2024 14:10:02 -0700 Subject: [PATCH 03/14] trying different changed to get create pull request working --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c42447ff..809ae427 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -35,12 +35,12 @@ jobs: - name: Create Pull Request uses: peter-evans/create-pull-request@v7 with: + branch: release/${{inputs.new_version}} commit-message: 'Release v${{inputs.new_version}}' title: 'Release v${{inputs.new_version}}' body: > This PR is auto-generated by [create-pull-request](https://github.com/peter-evans/create-pull-request). - labels: release, automated pr base: main From 394f4ba3ffe96eb9936528e8cf55be5e501fedf0 Mon Sep 17 00:00:00 2001 From: Bryce Buchanan Date: Mon, 28 Oct 2024 14:13:00 -0700 Subject: [PATCH 04/14] added pull-requests write permissions --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 809ae427..e99551cc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,6 +10,7 @@ jobs: runs-on: ubuntu-latest permissions: contents: write + pull-requests: write steps: - uses: actions/checkout@v4 with: From b0c42ab4d03f46dccf7ec50f2d06f5b52d38e85a Mon Sep 17 00:00:00 2001 From: Bryce Buchanan Date: Mon, 28 Oct 2024 15:00:38 -0700 Subject: [PATCH 05/14] added special token to allow for on: merge triggers & actions running --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e99551cc..6688d559 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -36,6 +36,7 @@ jobs: - name: Create Pull Request uses: peter-evans/create-pull-request@v7 with: + token: ${{ secrets.RELEASE_TOKEN }} branch: release/${{inputs.new_version}} commit-message: 'Release v${{inputs.new_version}}' title: 'Release v${{inputs.new_version}}' From c029a3797d23e8d0f6ea6341a55dd58daf8a78d4 Mon Sep 17 00:00:00 2001 From: Bryce Buchanan Date: Mon, 28 Oct 2024 15:13:25 -0700 Subject: [PATCH 06/14] trying a different token --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6688d559..e2ac095c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -36,7 +36,7 @@ jobs: - name: Create Pull Request uses: peter-evans/create-pull-request@v7 with: - token: ${{ secrets.RELEASE_TOKEN }} + token: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }} branch: release/${{inputs.new_version}} commit-message: 'Release v${{inputs.new_version}}' title: 'Release v${{inputs.new_version}}' From a3b68970e6d806e2e94d55b57123ad31b23bd82b Mon Sep 17 00:00:00 2001 From: Bryce Buchanan Date: Mon, 28 Oct 2024 16:16:00 -0700 Subject: [PATCH 07/14] added release tag action --- .github/workflows/TagRelease.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/workflows/TagRelease.yml diff --git a/.github/workflows/TagRelease.yml b/.github/workflows/TagRelease.yml new file mode 100644 index 00000000..b856219e --- /dev/null +++ b/.github/workflows/TagRelease.yml @@ -0,0 +1,21 @@ +name: Tag & Note Release +on : + pull_request: + branches: + - main + types: + - closed +jobs: + TagRelease: + runs-on: ubuntu-latest + steps: + - name: Check if merge is release branch + id: check-release + run: | + if [[ ${{ github.head_ref }} =~ ^release/v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + echo "match=true" >> $GITHUB_OUTPUT + fi + - name: + if: github.event.pull_request.merged == true && steps.check-release.outputs.match == true + run: echo This is a release branch ${{ github.head_ref }} + From 7933e49b730fe7c70279e407fcafb494b4b2c0c2 Mon Sep 17 00:00:00 2001 From: Bryce Buchanan Date: Mon, 28 Oct 2024 16:19:17 -0700 Subject: [PATCH 08/14] fixed token --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e2ac095c..6688d559 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -36,7 +36,7 @@ jobs: - name: Create Pull Request uses: peter-evans/create-pull-request@v7 with: - token: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }} + token: ${{ secrets.RELEASE_TOKEN }} branch: release/${{inputs.new_version}} commit-message: 'Release v${{inputs.new_version}}' title: 'Release v${{inputs.new_version}}' From b93c154f551f46a7b3693c4b04d481e4dc533f83 Mon Sep 17 00:00:00 2001 From: Bryce Buchanan Date: Mon, 28 Oct 2024 16:24:23 -0700 Subject: [PATCH 09/14] test --- .github/workflows/TagRelease.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/workflows/TagRelease.yml diff --git a/.github/workflows/TagRelease.yml b/.github/workflows/TagRelease.yml new file mode 100644 index 00000000..813a4b28 --- /dev/null +++ b/.github/workflows/TagRelease.yml @@ -0,0 +1,21 @@ +name: Tag & Note Release +on : + pull_request: + branches: + - main + types: + - closed +jobs: + TagRelease: + runs-on: ubuntu-latest + steps: + - name: Check if merge is release branch + id: check-release + run: | + if [[ ${{ github.head_ref }} =~ ^release/v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + echo "match=true" >> $GITHUB_OUTPUT + fi + - name: Tag if + if: github.event.pull_request.merged == true && steps.check-release.outputs.match == true + run: echo This is a release branch ${{ github.head_ref }} + From 3aa948cc65c0c7dd57ab1df17b510a2640267695 Mon Sep 17 00:00:00 2001 From: Bryce Buchanan Date: Tue, 29 Oct 2024 09:16:37 -0700 Subject: [PATCH 10/14] added additional release steps --- .../{release.yml => Create-Release-PR.yml} | 3 +- .github/workflows/PR-Release-Warning.yml | 25 ++++++++++++++ .github/workflows/Tag-And-Release.yml | 34 +++++++++++++++++++ .github/workflows/TagRelease.yml | 21 ------------ 4 files changed, 61 insertions(+), 22 deletions(-) rename .github/workflows/{release.yml => Create-Release-PR.yml} (94%) create mode 100644 .github/workflows/PR-Release-Warning.yml create mode 100644 .github/workflows/Tag-And-Release.yml delete mode 100644 .github/workflows/TagRelease.yml diff --git a/.github/workflows/release.yml b/.github/workflows/Create-Release-PR.yml similarity index 94% rename from .github/workflows/release.yml rename to .github/workflows/Create-Release-PR.yml index 6688d559..75a1c08d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/Create-Release-PR.yml @@ -37,9 +37,10 @@ jobs: uses: peter-evans/create-pull-request@v7 with: token: ${{ secrets.RELEASE_TOKEN }} - branch: release/${{inputs.new_version}} + branch: release/v${{inputs.new_version}} commit-message: 'Release v${{inputs.new_version}}' title: 'Release v${{inputs.new_version}}' + delete-branch: true body: > This PR is auto-generated by [create-pull-request](https://github.com/peter-evans/create-pull-request). diff --git a/.github/workflows/PR-Release-Warning.yml b/.github/workflows/PR-Release-Warning.yml new file mode 100644 index 00000000..6e450f04 --- /dev/null +++ b/.github/workflows/PR-Release-Warning.yml @@ -0,0 +1,25 @@ +name: Warn Release Pull Requests +on: + pull_request: + branches: + - main + types: + - opened +jobs: + Check: + runs-on: ubuntu-latest + permissions: + pull-requests: write + steps: + - name: check branch name + id: check-release + run: | + if [[ ${{ github.head_ref }} =~ ^release/(v[0-9]+\.[0-9]+\.[0-9]+$) ]]; then + echo "match=true" >> $GITHUB_OUTPUT + fi + - name: add comment if PR is release + if: steps.check-release.outputs.match == 'true' + uses: mshick/add-pr-comment@v2 + with: + message: | + **WARNING** : This PR will trigger a release and tag when merged. diff --git a/.github/workflows/Tag-And-Release.yml b/.github/workflows/Tag-And-Release.yml new file mode 100644 index 00000000..a1f7984b --- /dev/null +++ b/.github/workflows/Tag-And-Release.yml @@ -0,0 +1,34 @@ +name: Tag & Note Release +on : + pull_request: + branches: + - main + types: + - closed +jobs: + CheckRelease: + runs-on: ubuntu-latest + steps: + - name: Check if merge is release branch + id: check-release + run: | + if [[ ${{ github.head_ref }} =~ ^release/(v[0-9]+\.[0-9]+\.[0-9]+$) ]]; then + echo "match=true" >> $GITHUB_OUTPUT + echo "version=${BASH_REMATCH[1]}" >> $GITHUB_OUTPUT + fi + - name: Tag if release branch + if: github.event.pull_request.merged != true || steps.check-release.outputs.match != 'true' + run: exit 1 + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.merge_commit_sha }} + fetch-depth: '0' + - uses: stefanzweifel/git-auto-commit-action@v5 + with: + commit_message: version bump to ${{ steps.check-release.outputs.version }} + tagging_message: 'v${{ steps.check-release.outputs.version }}' + - uses: ncipollo/release-action@v1 + with: + tag: v${{ steps.check-release.outputs.version }} + prerelease: true + generateReleaseNotes: true diff --git a/.github/workflows/TagRelease.yml b/.github/workflows/TagRelease.yml deleted file mode 100644 index b856219e..00000000 --- a/.github/workflows/TagRelease.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: Tag & Note Release -on : - pull_request: - branches: - - main - types: - - closed -jobs: - TagRelease: - runs-on: ubuntu-latest - steps: - - name: Check if merge is release branch - id: check-release - run: | - if [[ ${{ github.head_ref }} =~ ^release/v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then - echo "match=true" >> $GITHUB_OUTPUT - fi - - name: - if: github.event.pull_request.merged == true && steps.check-release.outputs.match == true - run: echo This is a release branch ${{ github.head_ref }} - From ab391e2a9948c9f5403e64b7d0d256d15358a36c Mon Sep 17 00:00:00 2001 From: Bryce Buchanan Date: Mon, 28 Oct 2024 16:24:23 -0700 Subject: [PATCH 11/14] test --- .github/workflows/TagRelease.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/workflows/TagRelease.yml diff --git a/.github/workflows/TagRelease.yml b/.github/workflows/TagRelease.yml new file mode 100644 index 00000000..813a4b28 --- /dev/null +++ b/.github/workflows/TagRelease.yml @@ -0,0 +1,21 @@ +name: Tag & Note Release +on : + pull_request: + branches: + - main + types: + - closed +jobs: + TagRelease: + runs-on: ubuntu-latest + steps: + - name: Check if merge is release branch + id: check-release + run: | + if [[ ${{ github.head_ref }} =~ ^release/v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + echo "match=true" >> $GITHUB_OUTPUT + fi + - name: Tag if + if: github.event.pull_request.merged == true && steps.check-release.outputs.match == true + run: echo This is a release branch ${{ github.head_ref }} + From 0985b6f52bd42a3b967e41db68917b1c40d18a66 Mon Sep 17 00:00:00 2001 From: Bryce Buchanan Date: Mon, 28 Oct 2024 16:16:00 -0700 Subject: [PATCH 12/14] added release tag action --- .github/workflows/TagRelease.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/TagRelease.yml b/.github/workflows/TagRelease.yml index 813a4b28..282ec519 100644 --- a/.github/workflows/TagRelease.yml +++ b/.github/workflows/TagRelease.yml @@ -15,7 +15,11 @@ jobs: if [[ ${{ github.head_ref }} =~ ^release/v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then echo "match=true" >> $GITHUB_OUTPUT fi +<<<<<<< HEAD - name: Tag if +======= + - name: +>>>>>>> a3b6897 (added release tag action) if: github.event.pull_request.merged == true && steps.check-release.outputs.match == true run: echo This is a release branch ${{ github.head_ref }} From 166c83851b367f9fa295f697f273e32de4cbf282 Mon Sep 17 00:00:00 2001 From: Bryce Buchanan Date: Tue, 29 Oct 2024 09:16:37 -0700 Subject: [PATCH 13/14] added additional release steps --- .github/workflows/TagRelease.yml | 25 ------------------------- 1 file changed, 25 deletions(-) delete mode 100644 .github/workflows/TagRelease.yml diff --git a/.github/workflows/TagRelease.yml b/.github/workflows/TagRelease.yml deleted file mode 100644 index 282ec519..00000000 --- a/.github/workflows/TagRelease.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: Tag & Note Release -on : - pull_request: - branches: - - main - types: - - closed -jobs: - TagRelease: - runs-on: ubuntu-latest - steps: - - name: Check if merge is release branch - id: check-release - run: | - if [[ ${{ github.head_ref }} =~ ^release/v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then - echo "match=true" >> $GITHUB_OUTPUT - fi -<<<<<<< HEAD - - name: Tag if -======= - - name: ->>>>>>> a3b6897 (added release tag action) - if: github.event.pull_request.merged == true && steps.check-release.outputs.match == true - run: echo This is a release branch ${{ github.head_ref }} - From df68de70c8587d541f8ba8b31714c88e736aba8c Mon Sep 17 00:00:00 2001 From: Bryce Buchanan Date: Tue, 29 Oct 2024 09:31:00 -0700 Subject: [PATCH 14/14] removed old action --- .github/workflows/TagRelease.yml | 21 --------------------- 1 file changed, 21 deletions(-) delete mode 100644 .github/workflows/TagRelease.yml diff --git a/.github/workflows/TagRelease.yml b/.github/workflows/TagRelease.yml deleted file mode 100644 index 813a4b28..00000000 --- a/.github/workflows/TagRelease.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: Tag & Note Release -on : - pull_request: - branches: - - main - types: - - closed -jobs: - TagRelease: - runs-on: ubuntu-latest - steps: - - name: Check if merge is release branch - id: check-release - run: | - if [[ ${{ github.head_ref }} =~ ^release/v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then - echo "match=true" >> $GITHUB_OUTPUT - fi - - name: Tag if - if: github.event.pull_request.merged == true && steps.check-release.outputs.match == true - run: echo This is a release branch ${{ github.head_ref }} -