Skip to content

Commit

Permalink
Move Deployments to S3 (#372)
Browse files Browse the repository at this point in the history
* change deployment to S3

* make deploy +x

* make sure that documents will be publically accessible

* Add cloudfront invalidation

* Add version to automatically update the monolith

* Use $GITHUB_SHA for version instead of current date

* inline deployment and remove unnecessary step

* revert deleting build step

* use script to install dependencies again
  • Loading branch information
FinnIckler authored Jan 30, 2024
1 parent 40a56d8 commit fa86dc1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 17 deletions.
22 changes: 12 additions & 10 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,18 @@ jobs:
- name: Run the PDF compilation process
run: bin/build.sh

- name: Push to GitHub build branch
uses: JamesIves/[email protected]
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
branch: build
folder: build
aws-access-key-id: ${{ secrets.CI_CD_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.CI_CD_AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_DEFAULT_REGION }}

- name: Trigger website deployment
env:
WCA_HOST: 34.208.140.116
- name: Trigger S3 deployment
run: |
mkdir -p $HOME/.ssh
echo "${{ secrets.DEPLOY_PRIVATE_KEY }}" > /tmp/deploy_rsa
bin/deploy.sh
aws s3 sync build s3://wca-documents/ --acl public-read
# Update version file so the website will update its cache
git_hash=$(git rev-parse --short "$GITHUB_SHA")
echo "$git_hash" > version
aws s3 cp version s3://wca-documents/version
aws cloudfront create-invalidation --distribution-id E31ELE3W069ZX7 --paths "/*" --output text
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# Generated PDF files.
build/
# Version of the generated pdfs
**/version
7 changes: 0 additions & 7 deletions bin/deploy.sh

This file was deleted.

0 comments on commit fa86dc1

Please sign in to comment.