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

New Release Process (Semi automatic way) #681

Merged
merged 4 commits into from
Nov 14, 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
20 changes: 7 additions & 13 deletions .github/workflows/prepare-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,12 @@ jobs:
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: Update makefile
run: sed -i.bak "s/OPERATOR_VERSION ?= .*/OPERATOR_VERSION ?= $OPERATOR_VERSION/g" Makefile && rm Makefile.bak
env:
OPERATOR_VERSION: ${{inputs.version}}

- name: Generate bundle
run: make bundle
Expand All @@ -44,10 +38,10 @@ jobs:
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 checkout -b releases/${{ 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 }}
git push -f --set-upstream origin releases/${{ 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 }}
23 changes: 19 additions & 4 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,32 @@
name: "Release"
on:
push:
tags: [ 'v*' ]

pull_request:
branches:
- main
types:
- closed
jobs:
release:
if: |
github.event.pull_request.merged == true && github.event.pull_request.head.repo.full_name == github.repository
&& github.event.pull_request.user.login == 'github-actions[bot]' && github.event.pull_request.user.type == 'Bot'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also check if the source branch of the PR starts with releases/? Maybe we use this bot account for more things in the future, and this workflow should only run on releases.

startsWith(github.event.pull_request.head.ref, 'releases/')

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

&& startsWith(github.event.pull_request.head.ref, 'releases/')
runs-on: ubuntu-22.04
steps:
- name: Determine operator version to release
id: operator-version
run: echo "version=${BRANCH#"releases/"}" >> "$GITHUB_OUTPUT"
env:
BRANCH: ${{ github.event.pull_request.head.ref }}

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.20"

- uses: actions/checkout@v4
with:
ref: main

- name: "generate release resources"
run: make release-artifacts
Expand All @@ -21,8 +36,8 @@ jobs:
- name: "create the release in GitHub"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OPERATOR_VERSION: ${{ steps.operator-version.outputs.version }}
run: |
OPERATOR_VERSION=$(git describe --tags | sed 's/^v//')
awk '/^## / {v=$2} v == "'${OPERATOR_VERSION}'" && !/^## / {print}' CHANGELOG.md > RELEASE_NOTES.md
gh release create \
-t "Release v${OPERATOR_VERSION}" \
Expand Down
2 changes: 1 addition & 1 deletion RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Steps to release a new version of the Tempo Operator:
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 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 against an OpenShift cluster (see below for instructions).
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`)
1. Once the PR above are merged and available in the `main` branch, it will trigger the release workflow which will create the tag and the GitHub release.

## Running e2e tests on OpenShift
A locally installed [CRC](https://github.com/crc-org/crc) cluster can be used for testing.
Expand Down
Loading