33 push :
44 tags :
55 - ' *'
6+
7+ permissions : {}
8+
69jobs :
710 bump :
811 name : Bump to -dev
912 runs-on : ubuntu-latest
13+ permissions :
14+ contents : write # to create and push to a branch
15+ pull-requests : write # to read and create pull requests
1016 steps :
1117 - uses : actions/checkout@v6
1218 with :
1319 ref : ${{ github.ref_name }}
1420 token : ${{ secrets.PODMANBOT_TOKEN }}
21+ persist-credentials : true
1522 - name : Bump
1623 id : bump
1724 run : |
18- ref=${{ github.ref_name }}
19- version=${ref#v}
25+ version=${GITHUB_REF_NAME#v}
2026 if [[ $version == *-rc* ]]; then
2127 devbump="${version%-*}-dev"
2228 echo "::notice:: is a rc - bumping z down to $devbump"
@@ -27,69 +33,75 @@ jobs:
2733 echo "::notice:: bumping z up to $devbump"
2834 fi
2935
30- sed -i "s/const RawVersion = ".*"/const RawVersion = \"${devbump}\"/g" version/rawversion/version.go
36+ sed --sandbox -i -e "s/const RawVersion = \ ".*\ "/const RawVersion = \"${devbump}\"/g" version/rawversion/version.go
3137
3238 echo "devbump=$devbump" >> $GITHUB_OUTPUT
3339 - name : Push
40+ env :
41+ DEVBUMP : ${{ steps.bump.outputs.devbump }}
3442 run : |
3543 # Make committer the user who triggered the action, either through cutting a release or manual trigger
3644 # 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 } }"
45+ git config --local user.name "${GITHUB_ACTOR}"
46+ git config --local user.email "${GITHUB_ACTOR_ID} +${GITHUB_ACTOR }@users.noreply.github.com"
47+ bumpbranch="bump-${DEVBUMP }"
4048 git checkout -b $bumpbranch
4149 git add version/rawversion/version.go
42- git commit --signoff -m "Bump Podman to v${{ steps.bump.outputs.devbump } }"
50+ git commit --signoff -m "Bump Podman to v${DEVBUMP }"
4351 git remote add podmanbot https://github.com/podmanbot/podman
4452 git push -f podmanbot "$bumpbranch"
4553 - name : Check open PRs
4654 id : checkpr
4755 env :
56+ DEVBUMP : ${{ steps.bump.outputs.devbump }}
4857 GH_TOKEN : ${{ secrets.PODMANBOT_TOKEN }}
4958 run : |
5059 prs=$(gh pr list \
51- --repo ${{ github.repository }} \
52- --head bump-${{ steps.bump.outputs.devbump }} \
60+ --repo "${GITHUB_REPOSITORY}" \
61+ --head " bump-${DEVBUMP}" \
5362 --state open \
5463 --json title \
5564 --jq 'length')
5665 if ((prs > 0)); then
57- echo "SKIPPING: PR already exists to update from ${{ github.ref_name } }."
66+ echo "SKIPPING: PR already exists to update from ${GITHUB_REF_NAME }."
5867 else
5968 echo "prexists=false" >> "$GITHUB_OUTPUT"
6069 fi
6170 - name : Open PR
6271 if : steps.checkpr.outputs.prexists == 'false'
6372 id : pr
73+ env :
74+ DEVBUMP : ${{ steps.bump.outputs.devbump }}
75+ GH_TOKEN : ${{ secrets.PODMANBOT_TOKEN }}
6476 run : |
65- bumpbranch="bump-${{ steps.bump.outputs.devbump }}"
66- ref=${{ github.ref_name }}
67- base=${ref%.*}
77+ bumpbranch="bump-${DEVBUMP}"
78+ base=${GITHUB_REF_NAME%.*}
6879 body=$(printf '```release-note\nNone\n```\n')
6980 gh pr create \
70- --title "Bump Podman to v${{ steps.bump.outputs.devbump } }" \
81+ --title "Bump Podman to v${DEVBUMP }" \
7182 --body "$body" \
7283 --head "podmanbot:$bumpbranch" \
7384 --base "$base" \
74- --repo ${{ github.repository }}
75- env :
76- GH_TOKEN : ${{ secrets.PODMANBOT_TOKEN }}
85+ --repo "${GITHUB_REPOSITORY}"
7786 mainbump :
7887 name : Bump on main
7988 runs-on : ubuntu-latest
89+ permissions :
90+ contents : write # to create and push to a branch
91+ pull-requests : write # to read and create pull requests
8092 env :
8193 GH_TOKEN : ${{ github.token }}
8294 steps :
8395 - uses : actions/checkout@v6
8496 with :
8597 ref : main
8698 token : ${{ secrets.PODMANBOT_TOKEN }}
99+ persist-credentials : true
87100 - name : Check version on main
88101 id : check
89102 run : |
90103 mainvers=`grep -P '(?<=const RawVersion = ")(\d.\d)' -o version/rawversion/version.go`
91- ref=${{ github.ref_name }}
92- releasevers=${ref#v}
104+ releasevers=${GITHUB_REF_NAME#v}
93105 if echo "${mainvers},${releasevers}" | tr ',' '\n' | sort -V -C
94106 then
95107 echo "bump=true" >> $GITHUB_OUTPUT
@@ -101,58 +113,61 @@ jobs:
101113 id : bump
102114 if : steps.check.outputs.bump == 'true'
103115 run : |
104- ref=${{ github.ref_name }}
105- releasevers=${ref#v}
116+ releasevers=${GITHUB_REF_NAME#v}
106117
107118 arr=($(echo "$releasevers" | tr . '\n'))
108119 arr[1]=$((${arr[1]}+1))
109120 arr[2]=0
110121 devbump="$(IFS=. ; echo "${arr[*]}")-dev"
111122 echo "::notice:: Bumping main to: $devbump"
112123
113- sed -i "s/const RawVersion = \".*\"/const RawVersion = \"$devbump\"/g" version/rawversion/version.go
124+ sed --sandbox -i -e "s/const RawVersion = \".*\"/const RawVersion = \"${ devbump} \"/g" version/rawversion/version.go
114125
115126 echo "devbump=$devbump" >> $GITHUB_OUTPUT
116127 - name : Push
117128 if : steps.check.outputs.bump == 'true'
129+ env :
130+ DEVBUMP : ${{ steps.bump.outputs.devbump }}
118131 run : |
119132 # 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 } }"
133+ # GitHub gives everyone a noreply email associated with their account, use that email for the sign-off
134+ git config --local user.name "${GITHUB_ACTOR}"
135+ git config --local user.email "${GITHUB_ACTOR_ID} +${GITHUB_ACTOR }@users.noreply.github.com"
136+ bumpbranch="bump-main-${DEVBUMP }"
124137 git checkout -b $bumpbranch
125138 git add version/rawversion/version.go
126- git commit --signoff -m "Bump main to v${{ steps.bump.outputs.devbump } }"
139+ git commit --signoff -m "Bump main to v${DEVBUMP }"
127140 git remote add podmanbot https://github.com/podmanbot/podman
128141 git push -f podmanbot "$bumpbranch"
129142 - name : Check open PRs
130143 id : checkpr
131144 if : steps.check.outputs.bump == 'true'
132145 env :
146+ DEVBUMP : ${{ steps.bump.outputs.devbump }}
133147 GH_TOKEN : ${{ secrets.PODMANBOT_TOKEN }}
134148 run : |
135149 prs=$(gh pr list \
136- --repo ${{ github.repository }} \
137- --head bump-main-${{ steps.bump.outputs.devbump }} \
150+ --repo "${GITHUB_REPOSITORY}" \
151+ --head " bump-main-${DEVBUMP}" \
138152 --state open \
139153 --json title \
140154 --jq 'length')
141155 if ((prs > 0)); then
142- echo "SKIPPING: PR already exists to update to ${{ steps.bump.outputs.devbump } }."
156+ echo "SKIPPING: PR already exists to update to ${DEVBUMP }."
143157 else
144158 echo "prexists=false" >> "$GITHUB_OUTPUT"
145159 fi
146160 - name : Open PR
147161 if : steps.check.outputs.bump == 'true' && steps.checkpr.outputs.prexists == 'false'
162+ env :
163+ DEVBUMP : ${{ steps.bump.outputs.devbump }}
164+ GH_TOKEN : ${{ secrets.PODMANBOT_TOKEN }}
148165 run : |
149- bumpbranch="bump-main-${{ steps.bump.outputs.devbump } }"
166+ bumpbranch="bump-main-${DEVBUMP }"
150167 body=$(printf '```release-note\nNone\n```\n')
151168 gh pr create \
152- --title "Bump main to v${{ steps.bump.outputs.devbump } }" \
169+ --title "Bump main to v${DEVBUMP }" \
153170 --body "$body" \
154171 --head "podmanbot:$bumpbranch" \
155172 --base "main" \
156- --repo ${{ github.repository }}
157- env :
158- GH_TOKEN : ${{ secrets.PODMANBOT_TOKEN }}
173+ --repo "${GITHUB_REPOSITORY}"
0 commit comments