labs #1581
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: Publish | |
on: | |
workflow_dispatch: | |
repository_dispatch: | |
push: | |
branches: | |
- master | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js 16 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
# Build Content | |
- run: npm install | |
- run: npm run lint | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js 16 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
- run: npm install | |
- run: npm run build:production | |
# Move _ to static/assets | |
- run: mkdir -p build/site/static | |
- run: mv build/site/_ build/site/static/assets | |
# Sync all files to S3 | |
- name: Sync to Static | |
uses: jakejarvis/s3-sync-action@master | |
with: | |
args: --acl public-read --follow-symlinks --exclude 'build/site/developer/index.html' | |
env: | |
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_REGION: ${{ secrets.AWS_S3_REGION }} | |
SOURCE_DIR: 'build/site/' | |
- name: Invalidate CloudFront Cache | |
uses: chetan/invalidate-cloudfront-action@v2 | |
env: | |
DISTRIBUTION: ${{ vars.AWS_CLOUDFRONT_DISTRIBUTION }} | |
PATHS: "/labs/* /developer/*" | |
AWS_REGION: ${{ secrets.AWS_S3_REGION }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
# Index into Algolia | |
# - run: npm run index | |
# env: | |
# ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }} | |
# ALGOLIA_APPLICATION_ID: ${{ secrets.ALGOLIA_APPLICATION_ID }} | |
# ALGOLIA_INDEXES: ${{ secrets.ALGOLIA_INDEXES }} |