diff --git a/.github/workflows/publish_stable.yml b/.github/workflows/publish_stable.yml index 02ee54f5a0..c68df3b266 100644 --- a/.github/workflows/publish_stable.yml +++ b/.github/workflows/publish_stable.yml @@ -30,7 +30,11 @@ jobs: exit 0 fi; + git fetch origin ${{ secrets.STABLE_YEAR }} + (git checkout ${{ secrets.STABLE_YEAR }} && git pull) || git checkout -b ${{ secrets.STABLE_YEAR }} origin/${{ secrets.STABLE_YEAR }} + git merge --ff-only main + git merge --ff-only ${{ secrets.STABLE_YEAR }} - name: Push if: env.PUBLISH_STABLE == 'true' || github.event.action == 'workflow_dispatch' @@ -38,3 +42,4 @@ jobs: PUBLISH_STABLE: ${{ secrets.PUBLISH_STABLE }} run: | git push origin stable + git push origin ${{ secrets.STABLE_YEAR }} diff --git a/.github/workflows/publish_year.yml b/.github/workflows/publish_year.yml new file mode 100644 index 0000000000..834ba89a14 --- /dev/null +++ b/.github/workflows/publish_year.yml @@ -0,0 +1,40 @@ +name: Publish Stable to Year +on: + push: + branches: + - stable + workflow_dispatch: + +jobs: + publish: + runs-on: ubuntu-latest + if: ${{ github.repository_owner == 'wpilibsuite' }} + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Merge + run: | + git config user.name github-actions + git config user.email github-actions@github.com + git config pull.ff only + + git fetch origin stable + (git checkout stable && git pull) || git checkout -b stable origin/stable + + git fetch origin ${{ secrets.STABLE_YEAR }} + (git checkout ${{ secrets.STABLE_YEAR }} && git pull) || git checkout -b ${{ secrets.STABLE_YEAR }} origin/${{ secrets.STABLE_YEAR }} + + if git merge-base --is-ancestor stable ${{ secrets.STABLE_YEAR }}; then + echo "No merge is necessary" + exit 0 + fi; + + git merge --ff-only stable + + - name: Push + if: env.PUBLISH_STABLE == 'true' || github.event.action == 'workflow_dispatch' + env: + PUBLISH_STABLE: ${{ secrets.PUBLISH_STABLE }} + run: | + git push origin ${{ secrets.STABLE_YEAR }}