Add support for slice annotations #497
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: CI + CD | |
on: | |
push: | |
branches: [ main ] | |
paths-ignore: | |
- '**.md' | |
- '.github/**' | |
pull_request: | |
branches: [ main ] | |
paths-ignore: | |
- '**.md' | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Node JS | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
cache: 'npm' | |
- name: Install dependencies | |
run: npm ci | |
- name: Run Prettier | |
run: npm run lint:prettier | |
- name: Run ESLint | |
run: npm run lint:eslint | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Node JS | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
cache: 'npm' | |
- name: Install dependencies | |
run: npm ci | |
- name: Build | |
run: npm run build | |
- name: Upload Build Artifact | |
uses: actions/upload-artifact@v3.1.2 | |
with: | |
name: build-artifact | |
path: build | |
deploy-surge: | |
name: Deploy preview to Surge | |
runs-on: ubuntu-latest | |
if: github.repository_owner == 'latticesurgery-com' && github.event_name == 'pull_request' | |
needs: [build] | |
permissions: | |
pull-requests: write | |
env: | |
SURGE_DOMAIN: ${{ format('https://{0}-{1}-pr{2}-preview.surge.sh', github.repository_owner, | |
github.event.repository.name, github.event.pull_request.number) }} | |
steps: | |
- name: Setup Node JS | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
- name: Download Build Artifact | |
uses: actions/download-artifact@v3.0.2 | |
with: | |
name: build-artifact | |
- name: Install Surge | |
run: npm install --global surge | |
- name: Deploy to Surge | |
run: | | |
cp index.html 200.html | |
surge ./ ${{ env.SURGE_DOMAIN }} | |
env: | |
SURGE_LOGIN: ${{ secrets.SURGE_LOGIN }} | |
SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }} | |
- name: Check if deploy comment exists | |
uses: peter-evans/find-comment@v2 | |
id: fc | |
with: | |
issue-number: ${{ github.event.pull_request.number }} | |
comment-author: 'github-actions[bot]' | |
body-includes: Preview is deployed to | |
- name: Share/Update deployment link | |
uses: peter-evans/create-or-update-comment@v2 | |
with: | |
comment-id: ${{ steps.fc.outputs.comment-id }} | |
issue-number: ${{ github.event.pull_request.number }} | |
body: | | |
Preview is deployed to ${{ env.SURGE_DOMAIN }} :sunglasses: | |
edit-mode: replace | |
deploy-staging: | |
name: Deploy to staging | |
runs-on: ubuntu-latest | |
if: github.repository_owner == 'latticesurgery-com' && github.event_name == 'push' | |
needs: [build] | |
environment: | |
name: Staging | |
url: 'https://dev.latticesurgery.com' | |
steps: | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ secrets.AWS_REGION }} | |
- name: Download Build Artifact | |
uses: actions/download-artifact@v3.0.2 | |
with: | |
name: build-artifact | |
- name: Upload to S3 | |
run: aws s3 sync . ${{ secrets.S3_BUCKET_PATH }} --delete | |
- name: Invalidate CloudFront cache | |
run: aws cloudfront create-invalidation --distribution-id ${{ secrets.CF_DISTRIBUTION_ID }} --paths '/index.html' | |
deploy-prod: | |
name: Deploy to production | |
runs-on: ubuntu-latest | |
if: github.repository_owner == 'latticesurgery-com' && github.event_name == 'push' | |
needs: [deploy-staging] | |
environment: | |
name: Production | |
url: 'https://latticesurgery.com' | |
steps: | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ secrets.AWS_REGION }} | |
- name: Download Build Artifact | |
uses: actions/download-artifact@v3.0.2 | |
with: | |
name: build-artifact | |
- name: Upload to S3 | |
run: aws s3 sync . ${{ secrets.S3_BUCKET_PATH }} --delete | |
- name: Invalidate CloudFront cache | |
run: aws cloudfront create-invalidation --distribution-id ${{ secrets.CF_DISTRIBUTION_ID }} --paths '/index.html' |