Skip to content

Commit

Permalink
Generate PR for release instead of commit to main (#658)
Browse files Browse the repository at this point in the history
* Generate PR for release instead of commit to main

Signed-off-by: Ruben Vargas <[email protected]>

* update RELEASE.md documentation

Signed-off-by: Ruben Vargas <[email protected]>

---------

Signed-off-by: Ruben Vargas <[email protected]>
  • Loading branch information
rubenvp8510 authored Oct 25, 2023
1 parent cce533e commit 165a208
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 31 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/prepare-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: "Prepare the release"
on:
workflow_dispatch:
inputs:
version:
description: version of the operator to release
required: true

jobs:
prepare-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${{ inputs.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${{ inputs.version }}
gh pr create --title='Prepare release v${{ inputs.version }}' --assignee=${{ github.actor }} --reviewer=${{ github.actor }} --body='v${{ inputs.version }}'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32 changes: 3 additions & 29 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
name: "Prepare the release"
name: "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
5 changes: 3 additions & 2 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
Steps to release a new version of the Tempo Operator:

1. Checkout the main branch, and make sure you have the latest changes.
1. Build, deploy and, run OpenShift tests locally against an OpenShift cluster `make e2e-openshift`. A locally installed [CRC](https://github.com/crc-org/crc) cluster can be used for testing.
1. Go to GitHub Actions Tab, In the left sidebar, choose "Prepare Release" Workflow, then push in the "Run workflow" button , select the main branch and type the version of operator to release
1. Push "Run workflow", this will trigger the process to generate the CHANGELOG and publish the images, and create the GitHub release
1. Push "Run workflow", this will trigger the process to generate the CHANGELOG and generate the bundle, this will create a PR with the title "Prepare Release vx.y.z`"
1. Once the PR is created, use that branch to build, deploy and, run OpenShift tests locally against an OpenShift cluster `make e2e-openshift`. A locally installed [CRC](https://github.com/crc-org/crc) cluster can be used for testing.
1. Once the PR above are merged and available in the `main` branch, tag it with the desired version, prefixed with `v`: `vx.y.z` (e.g. `git tag v0.1.0 && git push origin v0.1.0`)

Note: The e2e tests require MinIO (`make deploy-minio`) and opentelemetry-operator to be installed in the cluster.
```
Expand Down

0 comments on commit 165a208

Please sign in to comment.