Skip to content

Commit

Permalink
First pass on github action
Browse files Browse the repository at this point in the history
  • Loading branch information
huntercaron committed Mar 5, 2024
1 parent c57e9b0 commit baeafea
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
name: Upload plugins

on:
push:
branches:
- main

jobs:
deploy:
runs-on: ubuntu-latest

# NOTE: https://github.com/aws-actions/configure-aws-credentials#usage
permissions:
id-token: write
contents: read

steps:
- name: "Checkout repository"
uses: actions/checkout@v2

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "lts/*"

- name: Build artifacts
run: |
mkdir p
for dir in plugins/*/
do
dir=${dir%*/}
build_dir=${dir##*/}
echo "Processing $dir"
cd "${dir}"
yarn install
yarn run build --base /${build_dir}
# If your build outputs artifacts to a 'p' folder
mkdir "../../p/${build_dir}"
cp -R dist/* "../../p/${build_dir}"
cd - # return to root directory
done
- name: Configure AWS credentials
if: ${{ github.ref_name == 'main' }}
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: arn:aws:iam::946663360620:role/GitHubActions-framer-MiscAssets
aws-region: us-east-1

- name: Sync with S3
if: ${{ github.ref_name == 'main' }}
run: aws s3 sync ./p/ s3://946663360620-us-east-1-static-files --delete --exclude '.git/*' --exclude README.md --exclude '.github/*' --exclude .gitattributes --exclude .gitignore

- name: "Bust the CDN cache"
uses: chetan/invalidate-cloudfront-action@v2
env:
PATHS: "/*"
DISTRIBUTION: ${{ secrets.CLOUDFRONT_DISTRIBUTION }}

0 comments on commit baeafea

Please sign in to comment.