Skip to content

Commit

Permalink
Automatically cleanup prerelease branches after full release
Browse files Browse the repository at this point in the history
  • Loading branch information
ccremer committed Sep 21, 2021
1 parent ef677d9 commit e67cbe9
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ name: Docs

on:
push:
branches:
- master
tags:
- "*"

Expand Down Expand Up @@ -31,8 +29,7 @@ jobs:
echo "BRANCH_NAME=docs/v${{ steps.semver.outputs.major }}.${{ steps.semver.outputs.minor }}" >> $GITHUB_ENV
- name: Set branch name for Prerelease
if: ${{ steps.semver.outputs.prerelease != '' }}
# Cover all prereleases in one single rc branch. Administrators should manually delete the docs/vX.Y-rc branches from time to time for cleanup rc releases.
run: echo "BRANCH_NAME=docs/v${{ env.MINOR_VERSION}}-rc" >> $GITHUB_ENV
run: echo "BRANCH_NAME=${{ env.BRANCH_NAME }}-rc" >> $GITHUB_ENV

- name: Checkout remote branch if exists
run: git checkout ${{ env.BRANCH_NAME }}
Expand All @@ -52,7 +49,12 @@ jobs:
if: ${{ steps.semver.outputs.prerelease != '' }}

- name: Commit
run: git commit -all --message "Update version for Antora" --author "Antora via GitHub Actions <actions@github.com>"
run: git commit -all --message "Update version for Antora"
continue-on-error: true
- name: Push
run: git push --atomic --force --set-upstream origin ${{ env.BRANCH_NAME }}

- name: Cleanup prerelease branch if existing
if: ${{ steps.semver.outputs.prerelease == '' }}
run: git push origin --delete ${{ env.BRANCH_NAME }}-rc
continue-on-error: true

0 comments on commit e67cbe9

Please sign in to comment.