-
Notifications
You must be signed in to change notification settings - Fork 14
184 lines (157 loc) · 6.78 KB
/
release.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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
name: Publish HTML
on:
push:
tags: [ "*" ]
branches: [develop]
jobs:
release:
if: github.repository == 'freee/a11y-guidelines' && startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- name: Extract Branch/Tag Names
run: |
echo "NAME=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
echo "BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
- uses: actions/setup-python@v4
with:
python-version: '3.9.x'
- 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: install ja_JP.UTF-8 locale
run: |
sudo locale-gen ja_JP.UTF-8
sudo update-locale LANG=ja_JP.UTF-8
- name: Install the Latest pip
run: python -m pip install --upgrade pip
- name: Install required modules
run: python -m pip install -r requirements.txt --upgrade
- name: Prepare file upload directory with the archive directory
run: |
mkdir -p ${GITHUB_WORKSPACE}/upload/archive
mkdir -p ${GITHUB_WORKSPACE}/upload/en
- name: Download the existing archive files from S3
env:
AWS_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
run: aws s3 sync --delete s3://${AWS_BUCKET}/archive/ ${GITHUB_WORKSPACE}/upload/archive/ --quiet
- name: Build HTML of all releases, with gtag.js, and OGP tags
env:
GTM_ID: ${{ secrets.GTM_ID }}
TZ: Asia/Tokyo
run: |
make BASE_URL=https://a11y-guidelines.freee.co.jp/ sphinx_options="-A gtm_id=${GTM_ID}" clean html
cp -r ./ja/build/html/* ${GITHUB_WORKSPACE}/upload
cp -r ./en/build/html/* ${GITHUB_WORKSPACE}/upload/en
cp -r ./data/json/schemas ${GITHUB_WORKSPACE}/upload
make BASE_URL=https://a11y-guidelines.freee.co.jp/current/ sphinx_options="-A gtm_id=${GTM_ID}" clean html
mkdir -p ${GITHUB_WORKSPACE}/upload/current/en
cp -r ./ja/build/html/* ${GITHUB_WORKSPACE}/upload/current
cp -r ./en/build/html/* ${GITHUB_WORKSPACE}/upload/current/en
cp -r ./data/json/schemas ${GITHUB_WORKSPACE}/upload/current
make clean
current_commit=$(git rev-parse HEAD)
rm -rf ${GITHUB_WORKSPACE}/upload/archive/${TAG}
for _tag in `git tag` ; do \
echo "Processing ${_tag}..." ; \
if [ ! -d ${GITHUB_WORKSPACE}/upload/archive/${_tag} ] ; then \
git checkout ${_tag} ; \
git submodule update --init --recursive ; \
if [ ! -f ./build.mk ]; then
build_procedure=0 ; \
else \
build_procedure=`make build-procedure-version` ; \
fi ; \
if [ ${build_procedure} -eq 0 ]; then
make SPHINXOPTS="-A gtm_id=${GTM_ID} -D html_baseurl=https://a11y-guidelines.freee.co.jp/archive/${_tag}/" html ; \
if [ -d ./data/json/schemas ]; then \
cp -r ./data/json/schemas ./build/html ; \
fi ; \
cp -r ./build/html ${GITHUB_WORKSPACE}/upload/archive/${_tag} ; \
elif [ ${build_procedure} -eq 1 ]; then \
make BASE_URL=https://a11y-guidelines.freee.co.jp/archive/${_tag}/ sphinx_options="-A gtm_id=${GTM_ID}" clean html ; \
mkdir -p ${GITHUB_WORKSPACE}/upload/archive/${_tag}/en ; \
cp -r ./ja/build/html/* ${GITHUB_WORKSPACE}/upload/archive/${_tag} ; \
cp -r ./en/build/html/* ${GITHUB_WORKSPACE}/upload/archive/${_tag}/en
cp -r ./data/json/schemas ${GITHUB_WORKSPACE}/upload/archive/${_tag} ; \
else \
echo "Unknown build procedure version: ${build_procedure}" ; \
exit 1 ; \
fi ; \
make clean ; \
git checkout ${current_commit} ; \
git submodule update --init --recursive ; \
fi ; \
done
- name: Publish to S3
env:
AWS_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
run: aws s3 sync --delete ${GITHUB_WORKSPACE}/upload/ s3://${AWS_BUCKET}/ --quiet
- name: Prepare the HTML Archive
env:
TZ: Asia/Tokyo
run: |
make BASE_URL=/ clean html
mv ./ja/build/html ./freee-a11y-guidelines-${TAG}
cp -r ./data/json/schemas ./freee-a11y-guidelines-${TAG}
cp -r ./en/build/html ./freee-a11y-guidelines-${TAG}/en
zip -r ${GITHUB_WORKSPACE}/freee-a11y-guidelines-${TAG}-html.zip ./freee-a11y-guidelines-${TAG}
- name: Create Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create ${TAG} \
--title "Ver. ${TAG}" \
--notes-file ./ja/source/intro/ChangeLog/${TAG:0:4}/${TAG}.rst \
--draft
gh release upload ${TAG} ${GITHUB_WORKSPACE}/freee-a11y-guidelines-${TAG}-html.zip
current:
if: github.repository == 'freee/a11y-guidelines' && github.ref == 'refs/heads/develop'
runs-on: ubuntu-latest
steps:
- name: Extract Branch/Tag Names
run: |
echo "NAME=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
echo "BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/setup-python@v4
with:
python-version: '3.9.x'
- 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: install ja_JP.UTF-8 locale
run: |
sudo locale-gen ja_JP.UTF-8
sudo update-locale LANG=ja_JP.UTF-8
- name: Install the Latest pip
run: python -m pip install --upgrade pip
- name: Install required modules
run: python -m pip install -r requirements.txt --upgrade
- name: Prepare file upload directory with the archive directory
run: mkdir -p ${GITHUB_WORKSPACE}/upload/current/en
- name: Build HTML with gtag.js, and OGP tags
env:
GTM_ID: ${{ secrets.GTM_ID }}
BASE_URL: https://a11y-guidelines.freee.co.jp/current/
TZ: Asia/Tokyo
run: |
make sphinx_options="-A gtm_id=${GTM_ID} -t current" clean html
cp -r ./data/json/schemas ./ja/build/html
cp -r ./ja/build/html/* ${GITHUB_WORKSPACE}/upload/current/
cp -r ./en/build/html/* ${GITHUB_WORKSPACE}/upload/current/en
- name: Publish to S3
env:
AWS_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
run: aws s3 sync --delete ${GITHUB_WORKSPACE}/upload/current/ s3://${AWS_BUCKET}/current/ --quiet