Workflow tweaks #2
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
--- | |
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@v4 | |
- 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 --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 }} |