Publish to Live #9
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish to Live | |
| on: | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| publish-to-live: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 #@v4.2.1 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.PUBLISH }} | |
| - name: Configure git | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| - name: Rebase live with main | |
| run: | | |
| set -e | |
| git checkout live | |
| git rebase origin/main || { | |
| echo "::error::Rebase of 'live' onto 'main' failed due to merge conflicts." | |
| echo "::error::Resolve the conflicts locally on branch 'live', complete the rebase, and push the updated branch to 'origin/live'." | |
| git rebase --abort || true | |
| exit 1 | |
| } | |
| - name: Push changes | |
| run: | | |
| git push origin live |