Skip to content

Sync Stable Branch with Slang Release #39

Sync Stable Branch with Slang Release

Sync Stable Branch with Slang Release #39

name: Sync Stable Branch with Slang Release
on:
schedule:
# Run at 3:00 AM UTC every day
- cron: '0 3 * * *'
workflow_dispatch: # Allow manual trigger
jobs:
sync-stable-branch:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout main branch
uses: actions/checkout@v4
with:
ref: main # Explicitly checkout main
# Fetch all history for all branches and tags
fetch-depth: 0
# Get submodules, but don't update them yet
submodules: 'recursive'
- name: Set up Git
run: |
git config --global user.name 'Read the Docs Bot'
git config --global user.email '[email protected]'
- name: Get latest slang release tag
id: slang_latest_tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Provide token explicitly for gh
run: |
LATEST_TAG=$(gh release view --repo shader-slang/slang --json tagName --jq .tagName)
if [ -z "$LATEST_TAG" ]; then
echo "Failed to fetch latest slang release tag using gh"
exit 1
fi
echo "tag=$LATEST_TAG" >> $GITHUB_OUTPUT
echo "Fetched latest slang tag: $LATEST_TAG"
- name: Update slang submodule to latest release tag
run: |
pushd docs/external/slang
git fetch --tags origin
git checkout ${{ steps.slang_latest_tag.outputs.tag }}
popd
echo "Checked out tag ${{ steps.slang_latest_tag.outputs.tag }} in docs/external/slang"
- name: Commit and push changes to stable branch
run: |
git add docs/external/slang
git commit -m "Sync stable to release (slang@${{ steps.slang_latest_tag.outputs.tag }})"
git push origin HEAD:stable --force
echo "Committed and force-pushed updates to stable branch."