Skip to content

Commit

Permalink
update deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanbagwell committed Aug 13, 2021
1 parent 149f2d9 commit a82e42f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
28 changes: 15 additions & 13 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
name: Update latest data
name: Build and Deploy
on:
workflow_dispatch:
schedule:
- cron: "30 9,10 * * 5" # Run at 5:30 and 6:30 pm every Thuesday Eastern Time (cron is in UTC)
push:
branches:
- master
jobs:
update-data:
deploy:
runs-on: ubuntu-latest
steps:
- name: Get current date
Expand Down Expand Up @@ -41,14 +42,15 @@ jobs:
${{ env.cache-name }}-${{ github.ref }}-
- name: Install dependencies
run: yarn install
- name: Fetch latest data file
run: ./downloadDataFile.js
- name: Verify successful build
- name: Build site
run: yarn build
- name: Commit & Push changes
uses: actions-js/push@master
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
branch: "master"
github_token: ${{ secrets.GITHUB_TOKEN }}
author_name: "Databot"
message: "Add latest data"
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Deploy
run: S3_BUCKET_NAME=${{ secrets.S3_BUCKET_NAME }} yarn deploy
- name: Invalidate cloudfront
run: CLOUDFRONT_DISTRIBUTON_ID=${{ secrets.CLOUDFRONT_DISTRIBUTON_ID }} yarn invalidate-cloudfront
2 changes: 1 addition & 1 deletion .github/workflows/update-data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ jobs:
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
- name: Check out repository code
uses: actions/checkout@v2
- run : git pull origin master
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
- run: echo "🖥️ The workflow is now ready to test your code on the runner."
- uses: actions/setup-node@v2
with:
node-version: "14.16.1"
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,11 @@
"build": "GATSBY_EXPERIMENTAL_PAGE_BUILD_ON_DATA_CHANGES=true gatsby build",
"develop": "gatsby develop",
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,md}\"",
"serve": "gatsby serve",
"serve": "gatsby serve",
"clean": "gatsby clean",
"test": "echo \"Write tests! -> https://gatsby.dev/unit-testing\" && exit 1",
"deploy": "aws s3 sync ./public s3://$S3_BUCKET_NAME/"
"deploy": "aws s3 sync ./public s3://$S3_BUCKET_NAME/",
"invalidate-cloudfront": "aws cloudfront create-invalidation --distribution-id $CLOUDFRONT_DISTRIBUTION_ID --paths \"/*\""
},
"repository": {
"type": "git",
Expand Down

0 comments on commit a82e42f

Please sign in to comment.