-
Notifications
You must be signed in to change notification settings - Fork 12
Adding automatic release workflow #390
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
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
9225122
Adding automatic release workflow
pablogarciamiranda 7bf101b
test: add temporary branch trigger for testing release workflow
pablogarciamiranda 3b49e1c
Adding gh release notes configuration
pablogarciamiranda 8190418
Fix linting
pablogarciamiranda 4356732
Fix linting
pablogarciamiranda 8899f2d
fix: organize release notes sections without duplication
pablogarciamiranda c164e64
fix: prevent duplicate What's Changed section in release notes
pablogarciamiranda 3bc6fe5
fix: use simpler release notes configuration
pablogarciamiranda 6418a17
Simplifying bump-version.sh and release.yaml by having already a sect…
pablogarciamiranda 9aa1d19
Adding new line to the end of the file
pablogarciamiranda 71aeb95
feat: add release note categories for better organization
pablogarciamiranda f9ce267
Simplify use only Version Bumps category for release notes
pablogarciamiranda 60e42b4
test: add test file to verify release notes categories
pablogarciamiranda 7a6e887
fix: remove emoji from Version Bumps title for consistency
pablogarciamiranda 7a6531e
remove test file and prepare for merge
pablogarciamiranda d57131d
Update config/manager/kustomization.yaml
pablogarciamiranda 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,11 @@ | ||
| --- | ||
| # GitHub Release Notes Configuration | ||
| # This file configures how GitHub auto-generates release notes | ||
| # It separates dependency updates into a "Version Bumps" section | ||
| # https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes | ||
|
|
||
| changelog: | ||
| categories: | ||
| - title: Version Bumps | ||
| labels: | ||
| - dependencies |
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,79 @@ | ||
| --- | ||
| name: Release | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - 'v*' | ||
|
|
||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
|
|
||
| jobs: | ||
| release: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Configure git | ||
| run: | | ||
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | ||
| git config --global user.name "github-actions[bot]" | ||
|
|
||
| - name: Get tag information | ||
| id: tag_data | ||
| run: | | ||
| # Get tag name and message | ||
| TAG_NAME=${GITHUB_REF#refs/tags/} | ||
| TAG_MESSAGE=$(git tag -n1 "$TAG_NAME" | sed "s/^$TAG_NAME[[:space:]]*//") | ||
|
|
||
| # If tag message is empty, use a default | ||
| if [ -z "$TAG_MESSAGE" ]; then | ||
| TAG_MESSAGE="Release $TAG_NAME" | ||
| fi | ||
|
|
||
| echo "TAG_NAME=$TAG_NAME" >> $GITHUB_OUTPUT | ||
| echo "TAG_MESSAGE<<EOF" >> $GITHUB_OUTPUT | ||
| echo "$TAG_MESSAGE" >> $GITHUB_OUTPUT | ||
| echo "EOF" >> $GITHUB_OUTPUT | ||
| echo "VERSION=${TAG_NAME#v}" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Create GitHub Release | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| # Determine if this is a prerelease | ||
| PRERELEASE="" | ||
| if [[ "${{ steps.tag_data.outputs.TAG_NAME }}" =~ (alpha|beta|rc) ]]; then | ||
| PRERELEASE="--prerelease" | ||
| fi | ||
|
|
||
| # Create release with auto-generated notes | ||
| gh release create "${{ steps.tag_data.outputs.TAG_NAME }}" \ | ||
| --title "${{ steps.tag_data.outputs.TAG_NAME }}" \ | ||
| --notes "${{ steps.tag_data.outputs.TAG_MESSAGE }}" \ | ||
| --generate-notes \ | ||
| $PRERELEASE | ||
|
|
||
| - name: Update kustomization.yaml | ||
| run: | | ||
| ./scripts/bump-version.sh "${{ steps.tag_data.outputs.TAG_NAME }}" | ||
|
|
||
| - name: Commit and push changes | ||
| run: | | ||
| # Check if there are changes to commit | ||
| if git diff --quiet; then | ||
| echo "No changes to commit" | ||
| exit 0 | ||
| fi | ||
|
|
||
| git add config/manager/kustomization.yaml | ||
| git commit -m "chore: bump version to ${{ steps.tag_data.outputs.TAG_NAME }} [skip ci]" | ||
|
|
||
| # Push to main branch | ||
| git push origin HEAD:main |
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 |
|---|---|---|
| @@ -1,2 +1,7 @@ | ||
| resources: | ||
| - manager.yaml | ||
|
|
||
| images: | ||
| - name: controller | ||
| newName: ghcr.io/netbox-community/netbox-operator | ||
| newTag: v0.2.8 |
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,27 @@ | ||
| #!/bin/bash | ||
| set -e | ||
|
|
||
| # Script to bump version in kustomization.yaml | ||
| # Usage: ./bump-version.sh <new_version> | ||
|
|
||
| NEW_VERSION=$1 | ||
|
|
||
| if [ -z "$NEW_VERSION" ]; then | ||
| echo "Usage: $0 <new_version>" | ||
| exit 1 | ||
| fi | ||
|
|
||
| KUSTOMIZATION_FILE="config/manager/kustomization.yaml" | ||
|
|
||
| if [ ! -f "$KUSTOMIZATION_FILE" ]; then | ||
| echo "Error: $KUSTOMIZATION_FILE not found!" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "Updating version to $NEW_VERSION in $KUSTOMIZATION_FILE..." | ||
|
|
||
| # Update the newTag | ||
| sed -i.bak "s/newTag: .*/newTag: $NEW_VERSION/" "$KUSTOMIZATION_FILE" | ||
| rm -f "$KUSTOMIZATION_FILE.bak" | ||
|
|
||
| echo "Version bumped to $NEW_VERSION successfully!" |
Oops, something went wrong.
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.