61 lines
1.6 KiB
YAML
61 lines
1.6 KiB
YAML
AWSTemplateFormatVersion: '2010-09-09'
|
|
Description: 'CloudFormation template for deploying Astro site to AWS Amplify'
|
|
|
|
Parameters:
|
|
GitHubAccessToken:
|
|
Type: String
|
|
NoEcho: true
|
|
Description: GitHub Access token for repository access
|
|
|
|
Resources:
|
|
AmplifyApp:
|
|
Type: AWS::Amplify::App
|
|
UpdateReplacePolicy: Retain
|
|
DeletionPolicy: Delete
|
|
Properties:
|
|
Name: blog_daisuke_nakahara
|
|
Repository: https://github.com/Daisuke897/blog_daisuke_nakahara
|
|
AccessToken: !Ref GitHubAccessToken
|
|
Platform: WEB
|
|
BuildSpec: |
|
|
version: 1
|
|
frontend:
|
|
phases:
|
|
preBuild:
|
|
commands:
|
|
- npm ci --cache .npm --prefer-offline
|
|
build:
|
|
commands:
|
|
- npm run build
|
|
artifacts:
|
|
baseDirectory: dist
|
|
files:
|
|
- '**/*'
|
|
cache:
|
|
paths:
|
|
- .npm/**/*
|
|
CustomRules:
|
|
- Source: '</^[^.]+$|\.(?!(css|gif|ico|jpg|js|png|txt|svg|woff|woff2|ttf|map|json)$)([^.]+$)/'
|
|
Target: '/index.html'
|
|
Status: '404-200'
|
|
EnableBranchAutoDeletion: false
|
|
CustomHeaders: ''
|
|
|
|
AmplifyBranch:
|
|
Type: AWS::Amplify::Branch
|
|
UpdateReplacePolicy: Retain
|
|
DeletionPolicy: Delete
|
|
Properties:
|
|
AppId: !GetAtt AmplifyApp.AppId
|
|
EnableAutoBuild: true
|
|
EnablePullRequestPreview: false
|
|
EnablePerformanceMode: false
|
|
Stage: PRODUCTION
|
|
BranchName: main
|
|
Framework: Astro
|
|
|
|
Outputs:
|
|
|
|
AppId:
|
|
Description: 'Amplify App ID'
|
|
Value: !GetAtt AmplifyApp.AppId
|