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

Generate PR for release instead of commit to main #658

Merged
merged 3 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
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
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
Loading