Skip to content

Commit 9897546

Browse files
committed
bump tooling and workflows
1 parent 04c51dc commit 9897546

6 files changed

Lines changed: 5524 additions & 3 deletions

File tree

.github/workflows/main.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,15 @@ jobs:
6666
AWS_S3_KEY_PREFIX: "${{env.REPOSITORY_NAME}}/"
6767
CANONICAL_LINK_PREFIX: ${{env.CANONICAL_LINK_PREFIX}}
6868
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
69+
70+
- name: Notify template repo to update submodule
71+
if: github.event_name == 'release' && github.repository == 'SMPTE/html-pub'
72+
env:
73+
GH_TOKEN: ${{ secrets.TEMPLATE_REPO_PAT }}
74+
TAG_NAME: ${{ github.event.release.tag_name }}
75+
run: |
76+
gh api repos/SMPTE/html-pub-template/dispatches \
77+
--method POST \
78+
--field event_type=tooling-release \
79+
--field "client_payload[tag]=${TAG_NAME}" \
80+
--field "client_payload[sha]=${GITHUB_SHA}"
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Update tooling submodule on new release
2+
3+
on:
4+
repository_dispatch:
5+
types: [tooling-release]
6+
7+
jobs:
8+
update-submodule:
9+
runs-on: ubuntu-latest
10+
if: github.repository_owner == 'SMPTE'
11+
12+
permissions:
13+
contents: write
14+
15+
steps:
16+
- name: Checkout template repo with submodule
17+
uses: actions/checkout@v3
18+
with:
19+
token: ${{ secrets.SUBMODULE_UPDATE_PAT }}
20+
submodules: true
21+
fetch-depth: 0
22+
23+
- name: Check if submodule is already at this SHA
24+
id: check
25+
env:
26+
TARGET_SHA: ${{ github.event.client_payload.sha }}
27+
run: |
28+
CURRENT_SHA=$(git -C tooling rev-parse HEAD)
29+
echo "current_sha=${CURRENT_SHA}" >> "$GITHUB_OUTPUT"
30+
if [[ "$CURRENT_SHA" == "$TARGET_SHA" ]]; then
31+
echo "already_up_to_date=true" >> "$GITHUB_OUTPUT"
32+
else
33+
echo "already_up_to_date=false" >> "$GITHUB_OUTPUT"
34+
fi
35+
36+
- name: Update submodule to release SHA
37+
if: steps.check.outputs.already_up_to_date != 'true'
38+
env:
39+
TARGET_SHA: ${{ github.event.client_payload.sha }}
40+
run: |
41+
git -C tooling fetch origin
42+
git -C tooling checkout "$TARGET_SHA"
43+
44+
- name: Commit and push to main
45+
if: steps.check.outputs.already_up_to_date != 'true'
46+
env:
47+
TAG: ${{ github.event.client_payload.tag }}
48+
TARGET_SHA: ${{ github.event.client_payload.sha }}
49+
CURRENT_SHA: ${{ steps.check.outputs.current_sha }}
50+
run: |
51+
git config user.name "github-actions[bot]"
52+
git config user.email "github-actions[bot]@users.noreply.github.com"
53+
git add tooling
54+
git commit -m "bump tooling to ${TAG}
55+
56+
Updates tooling submodule from ${CURRENT_SHA} to ${TARGET_SHA}."
57+
git push origin main

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# SMPTE HTML Publication artifacts
22
/build
3-
/package.json
4-
/package-lock.json
53

64
# MacOS
75
.DS_Store

0 commit comments

Comments
 (0)