chore: change artifact version #8
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: Production | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
environment: production | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: 🏃 Checkout | |
uses: actions/checkout@v4 | |
- name: 📌 Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: .nvmrc | |
cache: "yarn" | |
- name: ⏳ Install dependencies | |
run: yarn install | |
- name: 🏗️ Build | |
run: yarn build | |
env: | |
GATSBY_ALGOLIA_APP_ID: ${{ secrets.GATSBY_ALGOLIA_APP_ID }} | |
GATSBY_ALGOLIA_INDEX_NAME: ${{ secrets.GATSBY_ALGOLIA_INDEX_NAME }} | |
GATSBY_ALGOLIA_SEARCH_KEY: ${{ secrets.GATSBY_ALGOLIA_SEARCH_KEY }} | |
ALGOLIA_ADMIN_KEY: ${{ secrets.ALGOLIA_ADMIN_KEY }} | |
ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }} | |
- name: 📦 Packing build as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: public | |
path: public/ | |
retention-days: 1 | |
deploy: | |
needs: build | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: 🏃 Checkout | |
uses: actions/checkout@v4 | |
- name: 💻 Download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: public | |
path: public | |
- uses: kersvers/[email protected] | |
name: 🚀 Deploy to S3 and invalidate CloudFront cache | |
with: | |
args: --acl public-read --follow-symlinks --delete | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_KEY }} | |
AWS_S3_BUCKET: ${{ secrets.AWS_BUCKET_NAME }} | |
DISTRIBUTION_ID: ${{ secrets.AWS_DISTRIBUTION_ID }} | |
AWS_REGION: ${{ secrets.AWS_REGION }} | |
SOURCE_DIR: "public" |