Skip to content

Merge pull request #1641 from kubosho/dependabot/npm_and_yarn/markupl… #136

Merge pull request #1641 from kubosho/dependabot/npm_and_yarn/markupl…

Merge pull request #1641 from kubosho/dependabot/npm_and_yarn/markupl… #136

Workflow file for this run

name: Deploy Blog
on:
push:
branches:
- master
repository_dispatch:
types: [update_entry]
jobs:
deploy:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.os }}-yarn-
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/WebIdentityForGitHubActions
role-session-name: github-actions-session
aws-region: ap-northeast-1
- name: Install modules
run: yarn install
- name: Build application
run: yarn build
env:
X_MICROCMS_API_KEY: ${{ secrets.X_MICROCMS_API_KEY }}
X_MICROCMS_API_SUB_DOMAIN: ${{ secrets.X_MICROCMS_API_SUB_DOMAIN }}
X_MICROCMS_API_NAME: ${{ secrets.X_MICROCMS_API_NAME }}
- name: Deploy to S3
run: aws s3 sync ./dist/ s3://${{ secrets.S3_BUCKET_ID }}
- name: Create CloudFront invalidation
run: aws cloudfront create-invalidation --distribution-id ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }} --paths "/*"