Skip to content

Commit

Permalink
Generate PR for release instead of commit to main
Browse files Browse the repository at this point in the history
Signed-off-by: Ruben Vargas <[email protected]>
  • Loading branch information
rubenvp8510 committed Oct 24, 2023
1 parent 4183bb2 commit 237b2d2
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 28 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/prepare-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: "Prepare the release"
on:
workflow_dispatch:
inputs:
version:
description: version of the operator to release
required: true

jobs:
release:
runs-on: ubuntu-22.04
steps:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.20"

- name: Generate token
id: generate_token
uses: tibdex/github-app-token@v2
with:
app_id: ${{ secrets.PUBLISH_APP_ID }}
private_key: ${{ secrets.PUBLISH_APP_PRIVATE_KEY }}
installation_retrieval_payload: ${{ secrets.PUBLISH_APP_INSTALLATION_ID }}
installation_retrieval_mode: id

- uses: actions/checkout@v4
with:
token: ${{ steps.generate_token.outputs.token }}

- name: Generate bundle
run: make bundle
env:
OPERATOR_VERSION: ${{inputs.version}}
IMG_PREFIX: ghcr.io/grafana/tempo-operator

- name: Generate CHANGELOG
run: make chlog-update
env:
OPERATOR_VERSION: ${{inputs.version}}

# Commit all changed files back to the repository
- name: Commit the changes to the repository and create PR
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git checkout -b release/v${OPERATOR_VERSION}
git add -A
git commit -m "Prepare Release ${{inputs.version}}" --author="${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>"
git push -f --set-upstream origin release/v${OPERATOR_VERSION}
gh pr create --title='Prepare release v${OPERATOR_VERSION}' --assignee=${{ github.actor }} --reviewer=${{ github.actor }} --body='v${OPERATOR_VERSION}'
env:
OPERATOR_VERSION: ${{inputs.version}}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30 changes: 2 additions & 28 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
name: "Prepare the release"
on:
workflow_dispatch:
inputs:
version:
description: version of the operator to release
required: true

push:
tags: [ 'v*' ]

jobs:
release:
Expand All @@ -17,28 +13,6 @@ jobs:
go-version: "1.20"
- uses: actions/checkout@v4

- name: Generate bundle
run: make bundle
env:
OPERATOR_VERSION: ${{inputs.version}}
IMG_PREFIX: ghcr.io/grafana/tempo-operator

- name: Generate CHANGELOG
run: make chlog-update
env:
OPERATOR_VERSION: ${{inputs.version}}

# Commit all changed files back to the repository
- name: Commit the changes to the repository
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add -A
git commit -m "Release ${{inputs.version}}" --author="${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>"
git push
git tag v${{inputs.version}}
git push origin v${{inputs.version}}
- name: "generate release resources"
run: make release-artifacts
env:
Expand Down

0 comments on commit 237b2d2

Please sign in to comment.