Skip to content

Commit

Permalink
Initial deployment workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
OllieJC authored Aug 5, 2021
1 parent 58d8f42 commit e2cc7f7
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Deploy to S3

on:
push:
branches: [ main ]
workflow_dispatch:

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/checkout@v2
with:
repository: mitre/cti
path: cti

- uses: actions/setup-python@v2
with:
python-version: '3.8'
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: |
cd cti-generator/
python -m pip install -r requirements.txt
python main.py
cd ../
- name: Copy files using the AWS CLI
run: |
aws s3 cp js/ s3://tbat.app/js/ --recursive --acl public-read --cache-control "public, max-age=86400"
aws s3 cp cti/ s3://tbat.app/cti/ --recursive --acl public-read --cache-control "public, max-age=86400"
aws s3 cp css/ s3://tbat.app/css/ --recursive --acl public-read --cache-control "public, max-age=86400"
aws s3 cp index.html s3://tbat.app/index.html --acl public-read --cache-control "public, max-age=1800"

0 comments on commit e2cc7f7

Please sign in to comment.