Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,15 @@ jobs:
AWS_S3_KEY_PREFIX: "${{env.REPOSITORY_NAME}}/"
CANONICAL_LINK_PREFIX: ${{env.CANONICAL_LINK_PREFIX}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

- name: Notify template repo to update submodule
if: github.event_name == 'release' && github.repository == 'SMPTE/html-pub'
env:
GH_TOKEN: ${{ secrets.TEMPLATE_REPO_PAT }}
TAG_NAME: ${{ github.event.release.tag_name }}
run: |
gh api repos/SMPTE/html-pub-template/dispatches \
--method POST \
--field event_type=tooling-release \
--field "client_payload[tag]=${TAG_NAME}" \
--field "client_payload[sha]=${GITHUB_SHA}"
57 changes: 57 additions & 0 deletions .github/workflows/update-tooling-submodule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Update tooling submodule on new release

on:
repository_dispatch:
types: [tooling-release]

jobs:
update-submodule:
runs-on: ubuntu-latest
if: github.repository_owner == 'SMPTE'

permissions:
contents: write

steps:
- name: Checkout template repo with submodule
uses: actions/checkout@v3
with:
token: ${{ secrets.SUBMODULE_UPDATE_PAT }}
submodules: true
fetch-depth: 0

- name: Check if submodule is already at this SHA
id: check
env:
TARGET_SHA: ${{ github.event.client_payload.sha }}
run: |
CURRENT_SHA=$(git -C tooling rev-parse HEAD)
echo "current_sha=${CURRENT_SHA}" >> "$GITHUB_OUTPUT"
if [[ "$CURRENT_SHA" == "$TARGET_SHA" ]]; then
echo "already_up_to_date=true" >> "$GITHUB_OUTPUT"
else
echo "already_up_to_date=false" >> "$GITHUB_OUTPUT"
fi

- name: Update submodule to release SHA
if: steps.check.outputs.already_up_to_date != 'true'
env:
TARGET_SHA: ${{ github.event.client_payload.sha }}
run: |
git -C tooling fetch origin
git -C tooling checkout "$TARGET_SHA"

- name: Commit and push to main
if: steps.check.outputs.already_up_to_date != 'true'
env:
TAG: ${{ github.event.client_payload.tag }}
TARGET_SHA: ${{ github.event.client_payload.sha }}
CURRENT_SHA: ${{ steps.check.outputs.current_sha }}
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add tooling
git commit -m "bump tooling to ${TAG}

Updates tooling submodule from ${CURRENT_SHA} to ${TARGET_SHA}."
git push origin main
Loading