sanity-content-update #72
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: build-and-deploy | |
on: | |
push: | |
branches: [master] | |
repository_dispatch: | |
types: [sanity-content-update] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v3 | |
- name: Setup pnpm | |
uses: pnpm/action-setup@v4 | |
with: | |
version: 9.7.0+sha512.dc09430156b427f5ecfc79888899e1c39d2d690f004be70e05230b72cb173d96839587545d09429b55ac3c429c801b4dc3c0e002f653830a420fa2dd4e3cf9cf | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
cache: 'pnpm' | |
- name: Install dependencies | |
run: pnpm install | |
- name: Clean Gatsby build | |
run: pnpm gatsby clean | |
- name: Generate Environment Variables File for Production | |
run: | | |
echo "GATSBY_APP_SANITY_TOKEN=$GATSBY_APP_SANITY_TOKEN" >> .env | |
echo "GATSBY_APP_SANITY_PROJECT_ID=$GATSBY_APP_SANITY_PROJECT_ID" >> .env | |
echo "GATSBY_APP_SANITY_DATASET=$GATSBY_APP_SANITY_DATASET" >> .env | |
echo "GATSBY_APP_GA_ID=$GATSBY_APP_GA_ID" >> .env | |
env: | |
GATSBY_APP_SANITY_TOKEN: ${{ secrets.GATSBY_APP_SANITY_TOKEN }} | |
GATSBY_APP_SANITY_PROJECT_ID: ${{ secrets.GATSBY_APP_SANITY_PROJECT_ID }} | |
GATSBY_APP_SANITY_DATASET: ${{ secrets.GATSBY_APP_SANITY_DATASET }} | |
GATSBY_APP_GA_ID: ${{ secrets.GATSBY_APP_GA_ID }} | |
- name: Build application | |
run: pnpm gatsby build | |
- name: Deploy to S3 using gatsby-plugin-s3 | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_REGION: ap-northeast-2 | |
run: pnpm gatsby-plugin-s3 deploy --yes |