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

Github action to automatically update version branch after a release #285

Merged
merged 2 commits into from
Mar 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/updateVersionBranch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Update version branch

#When a release is done, this creates a PR from main to the released version branch to keep it updated.
#For example, if version "0.1.0" is released off of the main branch, then a PR from "main" to "0.x" will be created right after the release post-deploy is done.

on:
pull_request:
types:
- closed

permissions:
contents: read

jobs:
if_merged_postDeploy:
if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'post-release/')
runs-on: ubuntu-latest
name: Create PR to update version branch
steps:
- uses: elastic/apm-pipeline-library/.github/actions/github-token@current
with:
url: ${{ secrets.VAULT_ADDR }}
roleId: ${{ secrets.VAULT_ROLE_ID }}
secretId: ${{ secrets.VAULT_SECRET_ID }}
- uses: elastic/apm-pipeline-library/.github/actions/setup-git@current
with:
username: ${{ env.GIT_USER }}
email: ${{ env.GIT_EMAIL }}
token: ${{ env.GITHUB_TOKEN }}
- uses: actions/checkout@v4
- uses: actions-ecosystem/action-regex-match@v2
id: major-version
with:
text: ${{ github.event.pull_request.head.ref }}
regex: 'post-release/(\d+).+'

- run: gh pr create --base ${{ env.BASE_BRANCH }} --title 'Merge main into version branch' --body 'Created by Github action' --reviewer elastic/apm-agent-android
env:
GH_TOKEN: ${{ env.GITHUB_TOKEN }}
BASE_BRANCH: "${{ steps.major-version.outputs.group1 }}.x"
Loading