Runthrough of the devices API agian, as we near release #77
This file contains hidden or 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: Deploy to Production | |
on: | |
push: | |
branches: | |
- production | |
# https://github.com/ouzi-dev/commit-status-updater/tree/v2/#workflow-permissions | |
permissions: | |
contents: read | |
statuses: write | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 21 | |
- name: Cache npm | |
uses: actions/cache@v4 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Set deployment status | |
uses: ouzi-dev/commit-status-updater@v2 | |
with: | |
name: Deploy | |
status: pending | |
description: Preparing deploy | |
- name: Install | |
run: npm ci | |
- name: Build | |
run: npm run build | |
env: | |
PUBLIC_GOOGLE_ANALYTICS: ${{ secrets.PRODUCTION_PUBLIC_GOOGLE_ANALYTICS }} | |
- name: Deploy | |
if: success() | |
uses: jakejarvis/s3-sync-action@v0.5.1 | |
with: | |
args: --delete | |
env: | |
AWS_S3_BUCKET: ${{ vars.PRODUCTION_BUCKET_NAME }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.PRODUCTION_KEY }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.PRODUCTION_SECRET }} | |
AWS_REGION: ${{ vars.PRODUCTION_REGION }} | |
SOURCE_DIR: .vitepress/dist | |
- name: Set success deployment status | |
if: success() | |
uses: ouzi-dev/commit-status-updater@v2 | |
with: | |
name: Deploy | |
status: success | |
description: Deploy ready | |
url: ${{ vars.PRODUCTION_URL }} | |
- name: Set failed deployment status | |
if: failure() | |
uses: ouzi-dev/commit-status-updater@v2 | |
with: | |
name: Deploy | |
status: failure | |
description: Failed to deploy | |
- name: Invalidate CloudFront | |
uses: chetan/invalidate-cloudfront-action@v2 | |
env: | |
DISTRIBUTION: ${{ vars.PRODUCTION_DISTRIBUTION }} | |
PATHS: "/ /*" | |
AWS_REGION: ${{ vars.PRODUCTION_REGION }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.PRODUCTION_KEY }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.PRODUCTION_SECRET }} |