Skip to content

Deploy to S3

Deploy to S3 #1063

Workflow file for this run

name: Deploy to S3
on:
workflow_dispatch:
schedule:
- cron: "10 10 * * *" # 10:10 UTC every day
jobs:
deploy:
environment: live
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.9'
architecture: 'x64'
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-west-2
- name: Build static site
run: |
# if [ "${{ github.event_name }}" != 'push' ]; then
GET_SEC_TXT="true"
export GET_SEC_TXT=$GET_SEC_TXT
# fi
python -m pip install -r requirements.txt
python -m pip install --upgrade cryptography pyopenssl
python generator.py
- name: Copy files using the AWS CLI
run: |
aws s3 cp dist/.well-known/ s3://gotsecuritytxt.com/.well-known/ --recursive --acl public-read --cache-control "public, max-age=86400"
aws s3 cp dist/assets/ s3://gotsecuritytxt.com/assets/ --recursive --acl public-read --cache-control "public, max-age=31536000"
aws s3 cp dist/query.html s3://gotsecuritytxt.com --acl public-read --cache-control "private, max-age=60" --content-type "text/html"
aws s3 cp dist/gen-error.html s3://gotsecuritytxt.com --acl public-read --cache-control "private, max-age=60" --content-type "text/html"
aws s3 cp dist/query s3://gotsecuritytxt.com --acl public-read --cache-control "private, max-age=60" --content-type "text/html"
aws s3 cp dist/pending.html s3://gotsecuritytxt.com --acl public-read --cache-control "private, max-age=60" --content-type "text/html"
aws s3 cp dist/404.html s3://gotsecuritytxt.com --acl public-read --cache-control "public, max-age=604800" --content-type "text/html"
aws s3 cp dist/error.html s3://gotsecuritytxt.com --acl public-read --cache-control "public, max-age=604800" --content-type "text/html"
aws s3 cp dist/security.txt s3://gotsecuritytxt.com --acl public-read --cache-control "public, max-age=86400"
aws s3 cp dist/robots.txt s3://gotsecuritytxt.com --acl public-read --cache-control "public, max-age=86400"
aws s3 cp dist/site.webmanifest s3://gotsecuritytxt.com --acl public-read --cache-control "public, max-age=60" --content-type "application/json"
aws s3 cp dist/manifest.json s3://gotsecuritytxt.com --acl public-read --cache-control "public, max-age=60" --content-type "application/json"
aws s3 cp dist/api/ s3://gotsecuritytxt.com/api/ --recursive --acl public-read --cache-control "public, max-age=3600" --content-type "application/json"
# if [ "${{ github.event_name }}" != 'push' ]; then
aws s3 cp dist/top/ s3://gotsecuritytxt.com/top/ --recursive --acl public-read --cache-control "public, max-age=3600" --content-type "text/html"
aws s3 cp dist/index.html s3://gotsecuritytxt.com --acl public-read --cache-control "public, max-age=3600" --content-type "text/html"
aws s3 cp dist/only-valid s3://gotsecuritytxt.com --acl public-read --cache-control "public, max-age=3600" --content-type "text/html"
# fi