-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (53 loc) · 1.62 KB
/
aws-test.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: Deploy to AWS test
on:
push:
branches:
- master
pull_request:
branches:
- 'test/**'
workflow_dispatch:
jobs:
build:
if: github.actor != 'dependabot[bot]'
uses: ./.github/workflows/build.yaml
with:
site-origin: https://test.ryo-okami.xyz
site-base-path: ''
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: Preview
url: https://test.ryo-okami.xyz
steps:
- name: Checkout
uses: actions/checkout@v4
# Deploy to gh-pages should be in a git directory
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
name: blog-next
path: out
- name: Debug
run: |
ls -al out
cat out/sitemap.xml
- name: Configure AWS
uses: aws-actions/configure-aws-credentials@v4
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
env:
S3_BUCKET: test.ryo-okami.xyz
DISTRIBUTION_ID: E3DFPA0YC9J6TJ
run: |
aws s3 ls --region=ap-northeast-1
aws s3 ls s3://$S3_BUCKET --region=ap-northeast-1
aws s3 rm s3://$S3_BUCKET/ --recursive --region=ap-northeast-1
echo "After remove"
aws s3 ls s3://$S3_BUCKET --region=ap-northeast-1
aws s3 cp ./out s3://$S3_BUCKET/ --recursive --region=ap-northeast-1
aws cloudfront create-invalidation --distribution-id $DISTRIBUTION_ID --paths '/*' --region=us-east-1