-
Notifications
You must be signed in to change notification settings - Fork 3
155 lines (128 loc) · 4.38 KB
/
prod-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
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
name: 'Homepage orcid.org Deploy'
run-name: 'orcid.org deploy version ${{ inputs.version }} to ${{ inputs.environment }} by @${{ github.actor }}'
on:
workflow_dispatch:
inputs:
version:
type: string
description: 'Tag version to deploy'
required: true
default: 'v0.1.0'
jobs:
upload_prod_wordpress_to_qa_s3:
environment: qa.orcid.org
runs-on: ubuntu-latest
steps:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install requests beautifulsoup4
- name: Checkout repository
uses: actions/checkout@v3
- name: Switch to specific tag
run: |
git fetch --tags
git checkout ${{ github.event.inputs.version }}
- name: Upload HTML to S3
uses: reggionick/s3-deploy@v4
with:
folder: dist
bucket: ${{secrets.QA_AWS_BUCKET}}
bucket-region: ${{ secrets.AWS_REGION }}
dist-id: ${{secrets.QA_CLOUDFRONT_DIST_ID}}
invalidation: /
delete-removed: true
no-cache: true
private: true
files-to-include: '{.*/**,**}'
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: 'us-east-1'
- name: Validate QA Deployment
run: |
python wordpress-prod-release-validation.py QA
upload_prod_wordpress_to_fallback_s3:
runs-on: ubuntu-latest
environment: orcid.org
needs: upload_prod_wordpress_to_qa_s3
steps:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install requests beautifulsoup4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Checkout repository
uses: actions/checkout@v3
- name: Switch to specific tag
run: |
git fetch --tags
git checkout ${{ github.event.inputs.version }}
- name: Upload HTML to S3
uses: reggionick/s3-deploy@v4
with:
folder: dist
bucket: ${{ env.AWS_BUCKET }}
bucket-region: ${{ secrets.AWS_REGION }}
dist-id: ${{ env.CLOUDFRONT_DIST_ID }}
invalidation: /
delete-removed: true
no-cache: true
private: true
files-to-include: '{.*/**,**}'
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: 'us-east-1'
- name: Validate Fallback Deployment
run: |
python wordpress-prod-release-validation.py FALLBACK
upload_prod_wordpress_to_prod_s3:
runs-on: ubuntu-latest
environment: orcid.org
needs: upload_prod_wordpress_to_fallback_s3
steps:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Checkout repository
uses: actions/checkout@v3
- name: Switch to specific tag
run: |
git fetch --tags
git checkout ${{ github.event.inputs.version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install requests beautifulsoup4
- name: Set environment variables
run: |
echo "AWS_BUCKET=${{ secrets.PROD_AWS_BUCKET }}" >> $GITHUB_ENV
echo "CLOUDFRONT_DIST_ID=${{ secrets.PROD_CLOUDFRONT_DIST_ID }}" >> $GITHUB_ENV
- name: Upload HTML to S3
uses: reggionick/s3-deploy@v4
with:
folder: dist
bucket: ${{ env.AWS_BUCKET }}
bucket-region: ${{ secrets.AWS_REGION }}
dist-id: ${{ env.CLOUDFRONT_DIST_ID }}p;loi k,
invalidation: /
delete-removed: true
no-cache: true
private: true
files-to-include: '{.*/**,**}'
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: 'us-east-1'
- name: Validate Production Deployment
run: |
python wordpress-prod-release-validation.py PROD