-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #161 from bbc/philipn-update-static-flow-fixes
Use local shared-ext-update-static-files-workflow.yml
- Loading branch information
Showing
2 changed files
with
88 additions
and
1 deletion.
There are no files selected for viewing
87 changes: 87 additions & 0 deletions
87
.github/workflows/shared-ext-update-static-files-workflow.yml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
name: Shared Update Static Files Workflow | ||
on: | ||
workflow_call: | ||
inputs: | ||
commontoolingBranch: | ||
description: 'Commontooling branch or tag to use' | ||
required: true | ||
default: 'main' | ||
type: string | ||
secrets: | ||
WRITE_ACCESS_DEPLOY_KEY: | ||
description: 'A deploy key that is used to checkout code with write access' | ||
required: true | ||
COMMONTOOLING_DEPLOY_KEY: | ||
description: 'A deploy key that is used to fetch Commontooling' | ||
required: true | ||
|
||
env: | ||
COMMONTOOLING_BRANCH: ${{ inputs.commontoolingBranch == '' && 'main' || inputs.commontoolingBranch }} | ||
|
||
jobs: | ||
UpdateStaticFiles: | ||
permissions: | ||
contents: read | ||
runs-on: ubuntu-22.04 | ||
environment: | ||
name: update-static-files | ||
steps: | ||
- name: Check out repository code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 1 | ||
ssh-key: ${{ secrets.WRITE_ACCESS_DEPLOY_KEY }} | ||
|
||
- name: Login to Amazon ECR | ||
id: login-ecr | ||
uses: aws-actions/amazon-ecr-login@v2 | ||
with: | ||
registry-type: public | ||
mask-password: true | ||
|
||
- name: Initialise commontooling | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: bbc/rd-cloudfit-commontooling | ||
ref: ${{ env.COMMONTOOLING_BRANCH }} | ||
path: commontooling | ||
fetch-depth: 1 | ||
ssh-key: ${{ secrets.COMMONTOOLING_DEPLOY_KEY }} | ||
|
||
- name: Configure git user info | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "GitHub Actions" | ||
- name: Update static files | ||
run: | | ||
make static-files | ||
- name: Show git status | ||
run: | | ||
git status | ||
- name: Commit static file changes | ||
id: commitStaticFileChanges | ||
run: | | ||
git add . | ||
if git commit -a -m "Regenerate static files" | ||
then | ||
echo "haveChanges=true" >> $GITHUB_OUTPUT; | ||
else | ||
echo "haveChanges=false" >> $GITHUB_OUTPUT; | ||
fi | ||
- name: Push static file changes | ||
if: ${{ steps.commitStaticFileChanges.outputs.haveChanges == 'true' }} | ||
run: | | ||
git push | ||
- name: Adding summary | ||
run: | | ||
if [ '${{ steps.commitStaticFileChanges.outputs.haveChanges }}' == 'true' ] | ||
then | ||
echo "The static files have been updated" >> $GITHUB_STEP_SUMMARY | ||
else | ||
echo "There are no static file updates" >> $GITHUB_STEP_SUMMARY | ||
fi |
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