content-updated #96
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
name: "Merge Public to Main" | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- "lambda/**" | |
- "**/*.tf" | |
- "**/*.tf.j2" | |
- ".github/workflows/**" | |
workflow_dispatch: {} | |
repository_dispatch: | |
types: [content-updated] | |
env: | |
BUCKET_SUFFIX: handbook.burendo.com | |
jobs: | |
build-handbook: | |
name: "Build Handbook content" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: "3.x" | |
- name: "Install dependencies" | |
id: deps | |
run: pip install Jinja2 PyYAML boto3 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
role-skip-session-tagging: true | |
aws-access-key-id: ${{ secrets.ACTIONS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.ACTIONS_SECRET_ACCESS_KEY }} | |
role-to-assume: ${{ secrets.AWS_GHA_ROLE }} | |
role-duration-seconds: 900 | |
role-session-name: ${{ github.run_id }}-${{ github.run_number }} | |
aws-region: eu-west-2 | |
- name: "Bootstrap" | |
id: bootstrap | |
run: | | |
python bootstrap.py > ${{ github.workspace }}/${{ github.run_id }}-${{ github.run_number }}.log | |
sed -i "s/Administrator/ci/" terraform/variables.tf | |
working-directory: . | |
env: | |
TF_WORKSPACE: burendo-prod | |
AWS_SECRETS_ROLE: ${{ secrets.AWS_GHA_ROLE }} | |
AWS_DEFAULT_REGION: eu-west-2 | |
- name: "Pull PUBLIC handbook content" | |
id: public-content | |
run: | | |
git clone https://github.com/BurendoUK/burendo-handbook-public.git | |
working-directory: . | |
continue-on-error: false | |
- name: "Move PUBLIC handbook content" | |
id: public-content-copy | |
run: | | |
mkdir -p burendo-handbook/docs | |
mv burendo-handbook-public/docs/* burendo-handbook/docs | |
working-directory: . | |
continue-on-error: false | |
- name: "Move PUBLIC blog content" | |
id: public-blog-copy | |
run: | | |
mkdir -p burendo-handbook/blog | |
mv burendo-handbook-public/blog/* burendo-handbook/blog | |
working-directory: . | |
continue-on-error: false | |
- name: "Build handbook with content" | |
id: build-handbook | |
run: | | |
npm install | |
npm run build | |
working-directory: ./burendo-handbook | |
continue-on-error: false | |
- name: "Copy build output to PUBLIC S3" | |
id: copy-to-s3 | |
run: aws s3 sync build s3://${BUCKET_SUFFIX} --delete | |
working-directory: burendo-handbook | |
continue-on-error: false | |
- name: "Terminate Session" | |
if: ${{ always() }} | |
id: terminate-session | |
run: | | |
set -e | |
aws ssm terminate-session --session-id ${{ github.run_id }}-${{ github.run_number }} | |
- name: "Report Success" | |
uses: ravsamhq/notify-slack-action@v1 | |
if: ${{ success() }} | |
with: | |
status: success | |
notification_title: ':white_check_mark: *${{ github.workflow }} has succeeded* :white_check_mark:' | |
message_format: '_${{ github.workflow }}_ in *${{ github.repository }}* was triggered by ${{ github.triggering_actor }}' | |
footer: 'Run id is ${{ github.run_id }}' | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_BUILD_NOTIFICATIONS_WEBHOOK }} | |
- name: "Report Failure" | |
uses: ravsamhq/notify-slack-action@v1 | |
if: ${{ failure() }} | |
with: | |
status: failure | |
notification_title: ':alert: *${{ github.workflow }} has failed* :alert:' | |
message_format: '_${{ github.workflow }}_ in *${{ github.repository }}* was triggered by ${{ github.triggering_actor }}' | |
footer: 'Run id is ${{ github.run_id }}' | |
mention_groups: '${{ secrets.SLACK_ENGINEERING_GROUP_ID }}' | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_BUILD_NOTIFICATIONS_WEBHOOK }} |