Skip to content

Commit

Permalink
Merge pull request #21 from bbc/philipn-update-static-flow-fixes
Browse files Browse the repository at this point in the history
Use local shared-ext-update-static-files-workflow.yml
  • Loading branch information
philipnbbc authored Oct 3, 2024
2 parents a048627 + 6350418 commit e0b9048
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 1 deletion.
87 changes: 87 additions & 0 deletions .github/workflows/shared-ext-update-static-files-workflow.yml
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
2 changes: 1 addition & 1 deletion .github/workflows/update-static-files-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
permissions:
contents: read
# 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
uses: bbc/rd-cloudfit-commontooling/.github/workflows/shared-update-static-files-workflow.yml@main
uses: ./.github/workflows/shared-ext-update-static-files-workflow.yml
with:
commontoolingBranch: ${{ inputs.commontoolingBranch || 'main' }}
secrets: inherit

0 comments on commit e0b9048

Please sign in to comment.