Skip to content

Feature/newpages

Feature/newpages #74

Workflow file for this run

name: "Deploy new release"
on:
pull_request:
types:
- closed
branches:
- main
workflow_dispatch:
jobs:
infra:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Deploy CloudFormation Stack
uses: university-of-york/[email protected]
env:
TEMPLATE: cloudformation.yaml
AWS_STACK_NAME: ResearchITWebsiteStack
AWS_REGION: eu-west-1
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
CAPABILITIES: CAPABILITY_IAM CAPABILITY_NAMED_IAM
ROLE_ARN: arn:aws:iam::${{ secrets.AWS_USER_ID }}:role/GithubActionsDeploymentRole
TAGS: group=RESEARCHIT project=website status=prod pushed_by=githubaction defined_in=cloudformation repo_name=uoy-research/research-it-website-infrastructure user=sl561 team=rhpc
content:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.11.3'
- name: Install sphinx
run: pip install sphinx sphinx-rtd-theme
- name: Set AWS credentials
uses: aws-actions/configure-aws-credentials@v3
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-west-1
- name: Build site
run: TZ=UTC sphinx-build -a -b html docs/source/ site/
- name: Get Bucket name
id: get-bucket
run: |
echo "BUCKET_NAME=$(aws cloudformation describe-stacks --stack-name ResearchITWebsiteStack --query 'Stacks[0].Outputs[?OutputKey==`BucketName`].OutputValue' --output=text)" >> "$GITHUB_OUTPUT"
- name: Get CloudFront distribution id
id: get-distribution-id
run: |
echo "DISTRIBUTION_ID=$(aws cloudformation describe-stacks --stack-name ResearchITWebsiteStack --query 'Stacks[0].Outputs[?OutputKey==`CloudFrontDistributionID`].OutputValue' --output=text)" >> "$GITHUB_OUTPUT"
- name: Push to S3
run: aws s3 sync site/. s3://${{ steps.get-bucket.outputs.BUCKET_NAME }}
- name: Invalidate CloudFront distribution
run: |
aws cloudfront create-invalidation --distribution-id ${{ steps.get-distribution-id.outputs.DISTRIBUTION_ID }} --paths "/*"