-
Notifications
You must be signed in to change notification settings - Fork 3
58 lines (48 loc) · 1.53 KB
/
s3.yml
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
name: Deploy to S3
on:
workflow_dispatch:
inputs:
environment:
required: true
type: choice
options:
- aelf-docs-dev
- aefinder-docs-dev
- aefinder-docs-prod
- tomorrowdao-docs-dev
- tomorrowdao-docs-prod
jobs:
build:
environment:
name: ${{ inputs.environment }}
url: https://${{ vars.SITE_URL }}
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
cache: "npm"
- run: npm install
- name: create env file
run: |
touch .env
echo APP_ID=${{ secrets.APP_ID }} >> .env
echo APP_SECRET=${{ secrets.APP_SECRET }} >> .env
echo SPACE_ID=${{ vars.SPACE_ID }} >> .env
echo NEXT_PUBLIC_SITE_URL=${{ vars.SITE_URL }} >> .env
- run: npm run build
- name: Save environment variable to JSON
run: |
echo "{\"index\": \"${{ vars.TYPESENSE_INDEX }}\", \"host\": \"${{ vars.TYPESENSE_HOST }}\", \"apikey\": \"${{ vars.TYPESENSE_SEARCH_API_KEY }}\"}" > ./out/api/search
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
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: Sync to S3
run: aws s3 sync ./out s3://${{ secrets.AWS_S3_BUCKET }}