Merge pull request #96 from mirumirumi/dev #81
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: deploy | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 20.12.2 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.9" | |
- name: Install dependencies | |
run: npm ci | |
- name: Install Python modules | |
run: pip3 install httpx | |
- name: Decrypt secrets with gpg | |
run: | | |
echo "${{ secrets.GPG_PASSPHRASE }}" \ | |
| sudo gpg --batch --passphrase-fd 0 --output "src/secrets/secret.dev.js" --decrypt "src/secrets/secret.dev.js.gpg" | |
echo "${{ secrets.GPG_PASSPHRASE }}" \ | |
| sudo gpg --batch --passphrase-fd 0 --output "src/secrets/secret.prd.js" --decrypt "src/secrets/secret.prd.js.gpg" | |
- name: Generate site | |
run: | | |
npm run generate | |
- name: Generate XMLs | |
run: | | |
python3 .github/workflows/generate_sitemaps.py | |
python3 .github/workflows/generate_feeds.py | |
- name: Sign in | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-region: ap-northeast-1 | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
- name: Copy files to S3 | |
run: | | |
aws s3 rm \ | |
--region ap-northeast-1 \ | |
--recursive \ | |
--exclude "apps/*" \ | |
--exclude "assets/components/*" \ | |
s3://mirumime-prd-mirumi-me/ | |
aws s3 cp \ | |
--region ap-northeast-1 \ | |
--recursive \ | |
--cache-control "max-age=31536000" \ | |
.output/public/_nuxt/ s3://mirumime-prd-mirumi-me/_nuxt/ | |
aws s3 cp \ | |
--region ap-northeast-1 \ | |
--recursive \ | |
--cache-control "no-cache" \ | |
--exclude "_nuxt/*" \ | |
--exclude "assets/components/*" \ | |
.output/public/ s3://mirumime-prd-mirumi-me/ | |
- name: Purge CDN caches | |
run: | | |
aws cloudfront create-invalidation \ | |
--distribution-id E1UPWIMHFP5TEC \ | |
--paths "/*" |