Ship it #11
This file contains 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: Ship it | |
on: | |
workflow_dispatch: | |
jobs: | |
ship-it: | |
name: Ship it | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 | |
with: | |
# Ensure full history is fetched to have a clear | |
# path between next and master | |
fetch-depth: 0 | |
ref: next | |
# This is required to allow the final push to trigger dependent workflows | |
# The token is a PAT with the following permissions: | |
# - Read access to metadata | |
# - Read and Write access to code | |
# See https://stackoverflow.com/a/64078507/1618881 | |
token: ${{ secrets.SHIP_IT_TOKEN }} | |
- name: Checkout master branch | |
run: | | |
git fetch origin master | |
git checkout master | |
- name: Log commits to be shipped | |
id: commits-to-ship | |
run: | | |
git log --oneline master..next | |
echo "count=$(git log --oneline master..next | wc -l)" >> $GITHUB_OUTPUT | |
- name: Fast-forward master to next | |
if: steps.commits-to-ship.outputs.count != '0' | |
run: git merge --ff-only next | |
- name: Push updated master to origin | |
if: steps.commits-to-ship.outputs.count != '0' | |
run: git push origin master |