Skip to content

package.json忘れてた #19

package.json忘れてた

package.json忘れてた #19

Workflow file for this run

name: Deploy to S3 and Invalidate CloudFront
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./frontend
steps:
- uses: actions/checkout@v2
- name: setUp Node.js
uses: actions/setup-node@v2
with:
node-version: '20'
- name: Set environment variables
env:
VITE_API_URL: ${{ secrets.VITE_API_URL }} # GitHub Secretsを使用
run: echo "VITE_API_URL=$VITE_API_URL" >> $GITHUB_ENV
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- 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: ap-northeast-1
- name: Deploy to S3
run: aws s3 sync dist/ s3://www.fumiweb.net --delete
- name: Invalidate CloudFront
run: aws cloudfront create-invalidation --distribution-id ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }} --paths "/*"