|
| 1 | +name: Bump to -dev version |
| 2 | +on: |
| 3 | + push: |
| 4 | + tags: |
| 5 | + - '*' |
| 6 | +jobs: |
| 7 | + bump: |
| 8 | + name: Bump to -dev |
| 9 | + runs-on: ubuntu-latest |
| 10 | + steps: |
| 11 | + - uses: actions/checkout@v4 |
| 12 | + with: |
| 13 | + ref: ${{ github.ref_name }} |
| 14 | + token: ${{ secrets.PODMANBOT_TOKEN }} |
| 15 | + - name: Bump |
| 16 | + id: bump |
| 17 | + run: | |
| 18 | + ref=${{ github.ref_name }} |
| 19 | + version=${ref#v} |
| 20 | + if [[ $version == *-rc* ]]; then |
| 21 | + devbump="${version%-*}-dev" |
| 22 | + echo "::notice:: is a rc - bumping z down to $devbump" |
| 23 | + else |
| 24 | + arr=($(echo "$version" | tr . '\n')) |
| 25 | + arr[2]=$((${arr[2]}+1)) |
| 26 | + devbump="$(IFS=. ; echo "${arr[*]}")-dev" |
| 27 | + echo "::notice:: bumping z up to $devbump" |
| 28 | + fi |
| 29 | +
|
| 30 | + sed -i "s/const RawVersion = ".*"/const RawVersion = \"${devbump}\"/g" version/rawversion/version.go |
| 31 | +
|
| 32 | + echo "devbump=$devbump" >> $GITHUB_OUTPUT |
| 33 | + - name: Push |
| 34 | + run: | |
| 35 | + # Make committer the user who triggered the action, either through cutting a release or manual trigger |
| 36 | + # GitHub gives everyone a noreply email associated with their account, use that email for the sign-off |
| 37 | + git config --local user.name ${{ github.actor }} |
| 38 | + git config --local user.email "${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com" |
| 39 | + bumpbranch="bump-${{ steps.bump.outputs.devbump }}" |
| 40 | + git checkout -b $bumpbranch |
| 41 | + git add version/rawversion/version.go |
| 42 | + git commit --signoff -m "Bump Podman to v${{ steps.bump.outputs.devbump }}" |
| 43 | + git remote add podmanbot https://github.com/podmanbot/podman |
| 44 | + git push -f podmanbot "$bumpbranch" |
| 45 | + - name: Check open PRs |
| 46 | + id: checkpr |
| 47 | + env: |
| 48 | + GH_TOKEN: ${{ secrets.PODMANBOT_TOKEN }} |
| 49 | + run: | |
| 50 | + prs=$(gh pr list \ |
| 51 | + --repo ${{ github.repository }} \ |
| 52 | + --head bump-${{ steps.bump.outputs.devbump }} \ |
| 53 | + --state open \ |
| 54 | + --json title \ |
| 55 | + --jq 'length') |
| 56 | + if ((prs > 0)); then |
| 57 | + echo "SKIPPING: PR already exists to update from ${{ github.ref_name }}." |
| 58 | + else |
| 59 | + echo "prexists=false" >> "$GITHUB_OUTPUT" |
| 60 | + fi |
| 61 | + - name: Open PR |
| 62 | + if: steps.checkpr.outputs.prexists == 'false' |
| 63 | + id: pr |
| 64 | + run: | |
| 65 | + bumpbranch="bump-${{ steps.bump.outputs.devbump }}" |
| 66 | + ref=${{ github.ref_name }} |
| 67 | + base=${ref%.*} |
| 68 | + body=$(printf '```release-note\nNone\n```\n') |
| 69 | + gh pr create \ |
| 70 | + --title "Bump Podman to v${{ steps.bump.outputs.devbump }}" \ |
| 71 | + --body "$body" \ |
| 72 | + --head "podmanbot:$bumpbranch" \ |
| 73 | + --base "$base" \ |
| 74 | + --repo ${{ github.repository }} |
| 75 | + env: |
| 76 | + GH_TOKEN: ${{ secrets.PODMANBOT_TOKEN }} |
| 77 | + mainbump: |
| 78 | + name: Bump on main |
| 79 | + runs-on: ubuntu-latest |
| 80 | + env: |
| 81 | + GH_TOKEN: ${{ github.token }} |
| 82 | + steps: |
| 83 | + - uses: actions/checkout@v4 |
| 84 | + with: |
| 85 | + ref: main |
| 86 | + token: ${{ secrets.PODMANBOT_TOKEN }} |
| 87 | + - name: Check version on main |
| 88 | + id: check |
| 89 | + run: | |
| 90 | + mainvers=`grep -P '(?<=const RawVersion = ")(\d.\d)' -o version/rawversion/version.go` |
| 91 | + ref=${{ github.ref_name }} |
| 92 | + releasevers=${ref#v} |
| 93 | + if echo "${mainvers},${releasevers}" | tr ',' '\n' | sort -V -C |
| 94 | + then |
| 95 | + echo "bump=true" >> $GITHUB_OUTPUT |
| 96 | + echo "Main is lower than release, so we need to bump main" |
| 97 | + else |
| 98 | + echo "::notice:: SKIPPING: Main is higher than release, no need to bump" |
| 99 | + fi |
| 100 | + - name: Bump main |
| 101 | + id: bump |
| 102 | + if: steps.check.outputs.bump == 'true' |
| 103 | + run: | |
| 104 | + ref=${{ github.ref_name }} |
| 105 | + releasevers=${ref#v} |
| 106 | +
|
| 107 | + arr=($(echo "$releasevers" | tr . '\n')) |
| 108 | + arr[1]=$((${arr[1]}+1)) |
| 109 | + arr[2]=0 |
| 110 | + devbump="$(IFS=. ; echo "${arr[*]}")-dev" |
| 111 | + echo "::notice:: Bumping main to: $devbump" |
| 112 | +
|
| 113 | + sed -i "s/const RawVersion = \".*\"/const RawVersion = \"$devbump\"/g" version/rawversion/version.go |
| 114 | +
|
| 115 | + echo "devbump=$devbump" >> $GITHUB_OUTPUT |
| 116 | + - name: Push |
| 117 | + if: steps.check.outputs.bump == 'true' |
| 118 | + run: | |
| 119 | + # Make committer the user who triggered the action, either through cutting a release or manual trigger |
| 120 | + # GitHub gisves everyone a noreply email associated with their account, use that email for the sign-off |
| 121 | + git config --local user.name ${{ github.actor }} |
| 122 | + git config --local user.email "${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com" |
| 123 | + bumpbranch="bump-main-${{ steps.bump.outputs.devbump }}" |
| 124 | + git checkout -b $bumpbranch |
| 125 | + git add version/rawversion/version.go |
| 126 | + git commit --signoff -m "Bump main to v${{ steps.bump.outputs.devbump }}" |
| 127 | + git remote add podmanbot https://github.com/podmanbot/podman |
| 128 | + git push -f podmanbot "$bumpbranch" |
| 129 | + - name: Check open PRs |
| 130 | + id: checkpr |
| 131 | + if: steps.check.outputs.bump == 'true' |
| 132 | + env: |
| 133 | + GH_TOKEN: ${{ secrets.PODMANBOT_TOKEN }} |
| 134 | + run: | |
| 135 | + prs=$(gh pr list \ |
| 136 | + --repo ${{ github.repository }} \ |
| 137 | + --head bump-main-${{ steps.bump.outputs.devbump }} \ |
| 138 | + --state open \ |
| 139 | + --json title \ |
| 140 | + --jq 'length') |
| 141 | + if ((prs > 0)); then |
| 142 | + echo "SKIPPING: PR already exists to update to ${{ steps.bump.outputs.devbump }}." |
| 143 | + else |
| 144 | + echo "prexists=false" >> "$GITHUB_OUTPUT" |
| 145 | + fi |
| 146 | + - name: Open PR |
| 147 | + if: steps.check.outputs.bump == 'true' && steps.checkpr.outputs.prexists == 'false' |
| 148 | + run: | |
| 149 | + bumpbranch="bump-main-${{ steps.bump.outputs.devbump }}" |
| 150 | + body=$(printf '```release-note\nNone\n```\n') |
| 151 | + gh pr create \ |
| 152 | + --title "Bump main to v${{ steps.bump.outputs.devbump }}" \ |
| 153 | + --body "$body" \ |
| 154 | + --head "podmanbot:$bumpbranch" \ |
| 155 | + --base "main" \ |
| 156 | + --repo ${{ github.repository }} |
| 157 | + env: |
| 158 | + GH_TOKEN: ${{ secrets.PODMANBOT_TOKEN }} |
0 commit comments