-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c57e9b0
commit baeafea
Showing
1 changed file
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |