-
Notifications
You must be signed in to change notification settings - Fork 5
138 lines (120 loc) · 4.37 KB
/
deploy_whole_doc.yml
File metadata and controls
138 lines (120 loc) · 4.37 KB
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# This is a basic workflow to help you get started with Actions
name: Deploy the whole documentation
on:
push:
branches: [master, develop]
workflow_dispatch:
env:
NODE_VERSION: 20
jobs:
prepare-matrix:
name: Prepare matrix by getting the repo names from repositories.json
runs-on: ubuntu-24.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install yq
run: |
sudo apt-get update
sudo apt-get install python3 python3-pip
pip3 install yq
shell: bash
- name: Get repo names
id: set-matrix
run: |
export REPOS=$(cat .repos/repositories.json | yq -c '[.[]]')
echo "repo=$REPOS" >> $GITHUB_OUTPUT
outputs:
matrix: ${{ steps.set-matrix.outputs.repo }}
deploy_framework:
name: Deploy framework
runs-on: ubuntu-24.04
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-west-1
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Deploy artefact for production
uses: ./.github/actions/deploy_fw_artifacts
if: ${{ github.ref == 'refs/heads/master' }}
with:
S3_BUCKET: s3://docs.kuzzle.io
CLOUDFRONT_ID: E3D6RP0POLCJMM
- name: Deploy artefact for staging
uses: ./.github/actions/deploy_fw_artifacts
if: ${{ github.ref != 'refs/heads/master' }}
with:
S3_BUCKET: s3://docs-next.kuzzle.io
CLOUDFRONT_ID: E2ZCCEK9GRB49U
deploy_child_repo:
name: Deploy child repo ${{ matrix.repo.repo_name }}-${{ matrix.repo.doc_version }}
needs: [prepare-matrix, deploy_framework]
runs-on: ubuntu-24.04
strategy:
matrix:
repo: ${{ fromJson(needs.prepare-matrix.outputs.matrix) }}
fail-fast: false
steps:
- name: Recap of the build
run: echo "Build and deploy documentation for ${{ matrix.repo.repo_name }}-${{ matrix.repo.doc_version }}"
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_KEY }}
name: id_rsa
known_hosts: unnecessary
- name: Deploy production matrice
uses: ./.github/actions/deploy_repo
if: ${{ github.ref == 'refs/heads/master' }}
with:
repo_name: ${{ matrix.repo.repo_name }}
repo_version: ${{ matrix.repo.doc_version }}
repo_branch: ${{ matrix.repo.stable }}
REGION: us-west-2
S3_BUCKET: docs.kuzzle.io
CLOUDFRONT_ID: E3D6RP0POLCJMM
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
NO_INVALIDATION: true
- name: Deploy staging matrice
uses: ./.github/actions/deploy_repo
if: ${{ github.ref != 'refs/heads/master' }}
with:
repo_name: ${{ matrix.repo.repo_name }}
repo_version: ${{ matrix.repo.doc_version }}
repo_branch: ${{ matrix.repo.dev }}
REGION: us-west-2
S3_BUCKET: docs-next.kuzzle.io
CLOUDFRONT_ID: E2ZCCEK9GRB49U
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
NO_INVALIDATION: true
invalidate_cloudfront:
name: Invalidate CloudFront
needs: [deploy_child_repo]
runs-on: ubuntu-24.04
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-west-1
steps:
- name: Invalidate CloudFront for next-docs.kuzzle.io
if: ${{ github.ref != 'refs/heads/master' }}
run: aws cloudfront create-invalidation --distribution-id E2ZCCEK9GRB49U --paths "/*"
- name: Invalidate CloudFront for docs.kuzzle.io
if: ${{ github.ref == 'refs/heads/master' }}
run: aws cloudfront create-invalidation --distribution-id E3D6RP0POLCJMM --paths "/*"