Skip to content

Commit e8b59e7

Browse files
committed
Initialize release branches with release version
1 parent 68820ea commit e8b59e7

1 file changed

Lines changed: 15 additions & 7 deletions

File tree

.github/workflows/release_feature_freeze_ceremony.yaml

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -147,14 +147,22 @@ jobs:
147147
env:
148148
GITHUB_TOKEN: ${{ secrets.ORG_AUTOMATION_TOKEN }}
149149
run: |
150-
if git ls-remote --heads origin "${{ env.RELEASE_BRANCH }}" | grep -q "${{ env.RELEASE_BRANCH }}"; then
151-
echo "* ✓ the \`${{ env.RELEASE_BRANCH }}\` release branch exists" >> $GITHUB_STEP_SUMMARY
150+
RELEASE_BRANCH="${{ env.RELEASE_BRANCH }}"
151+
NEXT_VERSION="${{ env.NEXT_VERSION }}"
152+
153+
if git ls-remote --heads origin "$RELEASE_BRANCH" | grep -q "$RELEASE_BRANCH"; then
154+
echo "* ✓ the \`$RELEASE_BRANCH\` release branch exists" >> $GITHUB_STEP_SUMMARY
152155
else
153-
gh api repos/${{ github.repository }}/git/refs \
154-
--method POST \
155-
--field ref="refs/heads/${{ env.RELEASE_BRANCH }}" \
156-
--field sha="${{ github.sha }}"
157-
echo "* ✅ the \`${{ env.RELEASE_BRANCH }}\` release branch created" >> $GITHUB_STEP_SUMMARY
156+
git checkout -B "$RELEASE_BRANCH" "${{ github.sha }}"
157+
sed -i "s/^version = .*/version = $NEXT_VERSION/" version.config
158+
git add version.config
159+
if git diff --cached --quiet -- version.config; then
160+
echo "* ✓ version.config already set to \`$NEXT_VERSION\`" >> $GITHUB_STEP_SUMMARY
161+
else
162+
git commit -m "Initialize $RELEASE_BRANCH with version $NEXT_VERSION"
163+
fi
164+
git push origin "$RELEASE_BRANCH:$RELEASE_BRANCH"
165+
echo "* ✅ the \`$RELEASE_BRANCH\` release branch created with version \`$NEXT_VERSION\`" >> $GITHUB_STEP_SUMMARY
158166
fi
159167
160168
# -------------------------------------------------------

0 commit comments

Comments
 (0)