-
Notifications
You must be signed in to change notification settings - Fork 30
Workflow for Automating PR Creation for Release Updates #112
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
Open
AshwinSriram11
wants to merge
18
commits into
prometheus-operator:main
Choose a base branch
from
AshwinSriram11:workflow
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
f1849d9
Workflow to automate release updation
AshwinSriram11 0d0d703
minor formatting
AshwinSriram11 21eba92
Workflow to automate release updation
AshwinSriram11 f7fa419
minor formatting
AshwinSriram11 fc93abc
Change to older version for testing
AshwinSriram11 3e46209
Modify workflow for testing
AshwinSriram11 58908f7
Merge branch 'workflow' into test-wrokflow
AshwinSriram11 51d8c2b
Merge pull request #1 from AshwinSriram11/test-wrokflow
AshwinSriram11 0519cd2
Update website-release-update.yaml
AshwinSriram11 f17d733
Minor fixes
AshwinSriram11 b40ffb7
Merge branch 'workflow' into test-wrokflow
AshwinSriram11 d03f2d4
Merge pull request #2 from AshwinSriram11/test-wrokflow
AshwinSriram11 eb0223a
Workflow dispatch enabled
AshwinSriram11 2118472
Dispatch enabled
AshwinSriram11 f3b05a9
Merge pull request #3 from AshwinSriram11/test-wrokflow
AshwinSriram11 20fc037
Modified workflow for testing (#4)
AshwinSriram11 d14fdcc
Update prometheusOperator.json
AshwinSriram11 70af079
Set version to current
AshwinSriram11 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| name: Check and Update Release Version | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| schedule: | ||
AshwinSriram11 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - cron: '11 5 * * *' #Every day 05:11AM UTC | ||
|
|
||
| jobs: | ||
| check-and-update-release-version: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout repo | ||
| uses: actions/checkout@v4 | ||
| - name: Get latest release tag from prometheus-operator repository | ||
| id: get_latest_release | ||
| run: | | ||
| LATEST_RELEASE=$(curl --fail --silent "https://api.github.com/repos/prometheus-operator/prometheus-operator/releases/latest" | jq -r '.tag_name') | ||
| if [ "$LATEST_RELEASE" == "" ]; then | ||
| echo "latest-release is invalid" >> "$GITHUB_OUTPUT" | ||
| exit 1 | ||
| fi | ||
| echo "latest-release = $LATEST_RELEASE" >> "$GITHUB_OUTPUT" | ||
| - name: Check version in website repository | ||
| run: | | ||
| JSON_FILE="data/prometheusOperator.json" | ||
| CURRENT_VERSION=$(jq -r '.version' $JSON_FILE) | ||
| echo "Current version: $CURRENT_VERSION" | ||
|
|
||
| if [ "$CURRENT_VERSION" == "${{ steps.get_latest_release.outputs.latest_release }}" ]; then | ||
| echo "Latest version. No updates needed" | ||
| echo "update_needed=false" >> "$GITHUB_ENV" | ||
| else | ||
| echo "Versions do not match. An update is required." | ||
| echo "update_needed=true" >> "$GITHUB_ENV" | ||
| fi | ||
| - name: Update version | ||
| if: env.update_needed == 'true' | ||
| run: | | ||
| JSON_FILE="data/prometheusOperator.json" | ||
| NEW_VERSION="${{steps.get_latest_release.outputs.latest_release}}" | ||
|
|
||
| jq -i --arg version "$NEW_VERSION" '.version = $version' $JSON_FILE | ||
|
|
||
| git config --global user.name 'github-actions[bot]' | ||
| git config --global user.email 'github-actions[bot]@users.noreply.github.com' | ||
|
|
||
| git checkout -b update-version | ||
| git add $JSON_FILE | ||
| git commit -m "chore: bump to $NEW_VERSION" | ||
| git push origin update-version | ||
| - name: Create Pull Request | ||
| if: env.update_needed == 'true' | ||
| uses: peter-evans/create-pull-request@v7 | ||
| with: | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
| base: test-wrokflow #Testing in this branch before making changes to main | ||
| head: update-version | ||
| title: "chore: bump to ${{ steps.get_latest_release.outputs.latest_release }}" | ||
| body: "This PR updates the release version in prometheusOperator.json file to the latest version: ${{ steps.get_latest_release.outputs.latest_release }} " | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.