-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (63 loc) · 2.04 KB
/
deploy.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
on:
push:
branches:
- production
name: Build and Deploy
jobs:
build:
runs-on: ubuntu-latest
outputs:
revision: ${{ steps.current_revision.outputs.short }}
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
lfs: true
- name: Install NodeJS
uses: actions/setup-node@v1
with:
node-version: 20.x
- name: Verify versions
run: node --version && npm --version && node -p process.versions.v8
- name: Cache build context
id: cache-node
uses: actions/cache@v2
with:
path: |
~/.npm
.chappe
node_modules
key: ${{ runner.os }}-node
- name: Get current revision
id: current_revision
uses: pr-mpt/actions-commit-hash@v1
- name: Install dependencies
run: npm install --no-audit
- name: Build docs
run: npm run build production
- name: Archive build files
run: tar -zcvf ./build-${{ steps.current_revision.outputs.short }}.tar.gz build/
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ steps.current_revision.outputs.short }} Build
path: ./build-${{ steps.current_revision.outputs.short }}.tar.gz
retention-days: 7
deploy:
needs: build
environment: docs.prose.org
runs-on: ubuntu-latest
steps:
- name: Download build artifacts
uses: actions/download-artifact@v3
with:
name: ${{ needs.build.outputs.revision }} Build
- name: Extract build artifacts
run: tar -xzvf ./build-${{ needs.build.outputs.revision }}.tar.gz
- name: Deploy docs
env:
AWS_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_ACCESS_KEY }}
AWS_EC2_METADATA_DISABLED: true
run: |
aws s3 sync --delete --endpoint-url ${{ vars.S3_ENDPOINT }} build/ s3://${{ vars.S3_BUCKET }}/${{ vars.S3_SITE_DOMAIN }}/