Skip to content

Commit 14d019a

Browse files
authored
Merge pull request #91 from bbc/philipn-update-static-flow-fixes
Use local shared-ext-update-static-files-workflow.yml
2 parents cfadde5 + 2d88318 commit 14d019a

File tree

2 files changed

+88
-1
lines changed

2 files changed

+88
-1
lines changed
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: Shared Update Static Files Workflow
2+
on:
3+
workflow_call:
4+
inputs:
5+
commontoolingBranch:
6+
description: 'Commontooling branch or tag to use'
7+
required: true
8+
default: 'main'
9+
type: string
10+
secrets:
11+
WRITE_ACCESS_DEPLOY_KEY:
12+
description: 'A deploy key that is used to checkout code with write access'
13+
required: true
14+
COMMONTOOLING_DEPLOY_KEY:
15+
description: 'A deploy key that is used to fetch Commontooling'
16+
required: true
17+
18+
env:
19+
COMMONTOOLING_BRANCH: ${{ inputs.commontoolingBranch == '' && 'main' || inputs.commontoolingBranch }}
20+
21+
jobs:
22+
UpdateStaticFiles:
23+
permissions:
24+
contents: read
25+
runs-on: ubuntu-22.04
26+
environment:
27+
name: update-static-files
28+
steps:
29+
- name: Check out repository code
30+
uses: actions/checkout@v4
31+
with:
32+
fetch-depth: 1
33+
ssh-key: ${{ secrets.WRITE_ACCESS_DEPLOY_KEY }}
34+
35+
- name: Login to Amazon ECR
36+
id: login-ecr
37+
uses: aws-actions/amazon-ecr-login@v2
38+
with:
39+
registry-type: public
40+
mask-password: true
41+
42+
- name: Initialise commontooling
43+
uses: actions/checkout@v4
44+
with:
45+
repository: bbc/rd-cloudfit-commontooling
46+
ref: ${{ env.COMMONTOOLING_BRANCH }}
47+
path: commontooling
48+
fetch-depth: 1
49+
ssh-key: ${{ secrets.COMMONTOOLING_DEPLOY_KEY }}
50+
51+
- name: Configure git user info
52+
run: |
53+
git config --local user.email "github-actions@github.com"
54+
git config --local user.name "GitHub Actions"
55+
56+
- name: Update static files
57+
run: |
58+
make static-files
59+
60+
- name: Show git status
61+
run: |
62+
git status
63+
64+
- name: Commit static file changes
65+
id: commitStaticFileChanges
66+
run: |
67+
git add .
68+
if git commit -a -m "Regenerate static files"
69+
then
70+
echo "haveChanges=true" >> $GITHUB_OUTPUT;
71+
else
72+
echo "haveChanges=false" >> $GITHUB_OUTPUT;
73+
fi
74+
75+
- name: Push static file changes
76+
if: ${{ steps.commitStaticFileChanges.outputs.haveChanges == 'true' }}
77+
run: |
78+
git push
79+
80+
- name: Adding summary
81+
run: |
82+
if [ '${{ steps.commitStaticFileChanges.outputs.haveChanges }}' == 'true' ]
83+
then
84+
echo "The static files have been updated" >> $GITHUB_STEP_SUMMARY
85+
else
86+
echo "There are no static file updates" >> $GITHUB_STEP_SUMMARY
87+
fi

.github/workflows/update-static-files-workflow.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
permissions:
1616
contents: read
1717
# Github Actions doesn't allow the use of parameters in `uses` statements. If you want to use a different shared workflow branch, change it here
18-
uses: bbc/rd-cloudfit-commontooling/.github/workflows/shared-update-static-files-workflow.yml@main
18+
uses: ./.github/workflows/shared-ext-update-static-files-workflow.yml
1919
with:
2020
commontoolingBranch: ${{ inputs.commontoolingBranch || 'main' }}
2121
secrets: inherit

0 commit comments

Comments
 (0)