|
| 1 | +name: "Automated Version Update" |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + version: |
| 7 | + description: 'New version (X.Y.Z format, without v prefix)' |
| 8 | + required: true |
| 9 | + type: string |
| 10 | + create_draft: |
| 11 | + description: 'Create draft PR' |
| 12 | + required: false |
| 13 | + type: boolean |
| 14 | + default: false |
| 15 | + |
| 16 | +env: |
| 17 | + NEW_VERSION: ${{ github.event.inputs.version }} |
| 18 | + |
| 19 | +jobs: |
| 20 | + update-version: |
| 21 | + runs-on: ubuntu-latest |
| 22 | + steps: |
| 23 | + - name: Validate version format |
| 24 | + run: | |
| 25 | + if [[ ! "${{ env.NEW_VERSION }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then |
| 26 | + echo "❌ Invalid version format: ${{ env.NEW_VERSION }}" |
| 27 | + echo "Version must be in X.Y.Z format (e.g., 1.2.3)" |
| 28 | + exit 1 |
| 29 | + fi |
| 30 | + echo "✅ Version format is valid: ${{ env.NEW_VERSION }}" |
| 31 | +
|
| 32 | + - name: Checkout repository |
| 33 | + uses: actions/checkout@v4 |
| 34 | + with: |
| 35 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 36 | + |
| 37 | + - name: Configure Git |
| 38 | + run: | |
| 39 | + git config user.name "github-actions[bot]" |
| 40 | + git config user.email "github-actions[bot]@users.noreply.github.com" |
| 41 | +
|
| 42 | + - name: Create update branch |
| 43 | + run: | |
| 44 | + BRANCH_NAME="chore/update-version-${{ env.NEW_VERSION }}" |
| 45 | + echo "BRANCH_NAME=${BRANCH_NAME}" >> $GITHUB_ENV |
| 46 | + git checkout -b "${BRANCH_NAME}" |
| 47 | +
|
| 48 | + - name: Run make set_version |
| 49 | + run: | |
| 50 | + echo "🔄 Running make set_version VERSION=${{ env.NEW_VERSION }}" |
| 51 | + make set_version VERSION=${{ env.NEW_VERSION }} |
| 52 | + echo "✅ Version update completed" |
| 53 | +
|
| 54 | + - name: Check for changes |
| 55 | + id: check_changes |
| 56 | + run: | |
| 57 | + if git diff --quiet; then |
| 58 | + echo "No changes detected after running make set_version" |
| 59 | + echo "changes=false" >> $GITHUB_OUTPUT |
| 60 | + else |
| 61 | + echo "Changes detected:" |
| 62 | + git diff --name-only |
| 63 | + echo "changes=true" >> $GITHUB_OUTPUT |
| 64 | + fi |
| 65 | +
|
| 66 | + - name: Commit changes |
| 67 | + if: steps.check_changes.outputs.changes == 'true' |
| 68 | + run: | |
| 69 | + git add . |
| 70 | + git commit -m "chore: update version to ${{ env.NEW_VERSION }} |
| 71 | +
|
| 72 | + - Updated version references across multiple files |
| 73 | + - Generated by automated workflow |
| 74 | + |
| 75 | + Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>" |
| 76 | +
|
| 77 | + - name: Push branch |
| 78 | + if: steps.check_changes.outputs.changes == 'true' |
| 79 | + run: | |
| 80 | + git push origin "${{ env.BRANCH_NAME }}" |
| 81 | +
|
| 82 | + - name: Create Pull Request |
| 83 | + if: steps.check_changes.outputs.changes == 'true' |
| 84 | + uses: peter-evans/create-pull-request@v5 |
| 85 | + with: |
| 86 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 87 | + branch: ${{ env.BRANCH_NAME }} |
| 88 | + base: main |
| 89 | + title: "chore: update version to v${{ env.NEW_VERSION }}" |
| 90 | + body: | |
| 91 | + ## 🚀 Automated Version Update |
| 92 | +
|
| 93 | + This PR updates the project version from the current version to **v${{ env.NEW_VERSION }}**. |
| 94 | +
|
| 95 | + ### 📝 Changes Made |
| 96 | + |
| 97 | + The following files have been updated by running `make set_version VERSION=${{ env.NEW_VERSION }}`: |
| 98 | + |
| 99 | + - 📄 `Makefile` - Updated VERSION variable |
| 100 | + - 🔧 `config/manager/kustomization.yaml` - Updated image tags |
| 101 | + - 🔧 `config/samples/kustomization.yaml` - Updated image tags |
| 102 | + - ⚙️ `config/samples/config.yaml` - Updated daemon image version |
| 103 | + - 🔄 `.github/workflows/*.yaml` - Updated workflow image versions |
| 104 | + - 📖 `README.md` - Updated documentation examples |
| 105 | + - 🐳 Various Dockerfiles and configuration files |
| 106 | +
|
| 107 | + ### 🤖 Automation Details |
| 108 | + |
| 109 | + - **Triggered by**: @${{ github.actor }} |
| 110 | + - **Workflow**: `${{ github.workflow }}` |
| 111 | + - **Run ID**: `${{ github.run_id }}` |
| 112 | + |
| 113 | + ### ✅ Next Steps |
| 114 | + |
| 115 | + 1. Review the changes in this PR |
| 116 | + 2. Merge if everything looks correct |
| 117 | + 3. Create a new release tag: `v${{ env.NEW_VERSION }}` |
| 118 | + |
| 119 | + --- |
| 120 | + *This PR was created automatically by GitHub Actions* |
| 121 | + draft: ${{ github.event.inputs.create_draft }} |
| 122 | + labels: | |
| 123 | + chore |
| 124 | + release |
| 125 | + automated |
| 126 | +
|
| 127 | + - name: Summary |
| 128 | + if: steps.check_changes.outputs.changes == 'true' |
| 129 | + run: | |
| 130 | + echo "## 🎉 Version Update Summary" >> $GITHUB_STEP_SUMMARY |
| 131 | + echo "" >> $GITHUB_STEP_SUMMARY |
| 132 | + echo "- **New Version**: v${{ env.NEW_VERSION }}" >> $GITHUB_STEP_SUMMARY |
| 133 | + echo "- **Branch**: ${{ env.BRANCH_NAME }}" >> $GITHUB_STEP_SUMMARY |
| 134 | + echo "- **Status**: ✅ Pull Request Created" >> $GITHUB_STEP_SUMMARY |
| 135 | + echo "- **Draft**: ${{ github.event.inputs.create_draft }}" >> $GITHUB_STEP_SUMMARY |
| 136 | + echo "" >> $GITHUB_STEP_SUMMARY |
| 137 | + echo "🔗 [View Pull Request](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/pulls)" >> $GITHUB_STEP_SUMMARY |
| 138 | +
|
| 139 | + - name: No changes summary |
| 140 | + if: steps.check_changes.outputs.changes == 'false' |
| 141 | + run: | |
| 142 | + echo "## ℹ️ No Changes Required" >> $GITHUB_STEP_SUMMARY |
| 143 | + echo "" >> $GITHUB_STEP_SUMMARY |
| 144 | + echo "The version ${{ env.NEW_VERSION }} is already set in the repository." >> $GITHUB_STEP_SUMMARY |
| 145 | + echo "No pull request was created." >> $GITHUB_STEP_SUMMARY |
0 commit comments