-
Notifications
You must be signed in to change notification settings - Fork 7
/
website-build.yml
121 lines (104 loc) · 4.11 KB
/
website-build.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
- name: Build and deploy website
hosts: localhost
connection: local
gather_facts: false
become: yes
become_user: ansibler
vars:
tbsite: "/tmp/tbsite-{{ branch | default('master') }}"
tbsitebuild: "/tmp/tbsitebuild-{{ branch | default('master') }}"
notes: "/libs/thunderbird_notes"
locale: "/libs/locale"
productdetails: "/libs/product-details"
branch: "master"
pyver: "python3.11"
tasks:
- name: make sure temp dir is empty in case of previous failed build
file:
path: "{{ item }}"
state: absent
with_items:
- "{{ tbsite }}"
- "{{ tbsitebuild }}"
- name: checkout tb-website-builds history repo
git:
repo: "https://github.com/thunderbird/tb-website-builds.git"
dest: "{{ tbsitebuild }}"
version: "{{ branch | default('master') }}"
depth: 1
- name: checkout thunderbird-website
git:
repo: "https://github.com/thunderbird/thunderbird-website.git"
dest: "{{ tbsite }}"
version: "{{ branch | default('master') }}"
- name: checkout Mozilla localization files
git:
repo: "https://github.com/thunderbird/thunderbird.net-l10n.git"
dest: "{{ tbsite }}{{ locale }}"
version: "master"
depth: 1
- name: checkout release notes
git:
repo: "https://github.com/thunderbird/thunderbird-notes.git"
dest: "{{ tbsite }}{{ notes }}"
version: "{{ branch | default('master') }}"
- name: checkout product-details
git:
repo: "https://github.com/mozilla-releng/product-details.git"
dest: "{{ tbsite }}{{ productdetails }}"
version: "production"
- name: compile gettext files
command: bash l10n_tools/compile.sh
args:
chdir: "{{ tbsite }}"
- name: Install packages from requirements-dev.txt
pip:
requirements: "{{ tbsite }}/requirements-dev.txt"
virtualenv: "{{ tbsite }}/siteenv"
virtualenv_python: "{{ pyver }}"
- name: run website build
shell: "source {{ tbsite }}/siteenv/bin/activate && python build-site.py --debug"
args:
chdir: "{{ tbsite }}"
- name: run start page build
shell: "source {{ tbsite }}/siteenv/bin/activate && python build-site.py --startpage --debug"
args:
chdir: "{{ tbsite }}"
- name: run utn build
shell: "source {{ tbsite }}/siteenv/bin/activate && python build-site.py --updates --debug"
args:
chdir: "{{ tbsite }}"
- name: make sure temp dir is empty in case of previous failed build
file:
path: "{{ item }}"
state: absent
with_items:
- "{{ tbsitebuild }}/thunderbird.net"
- "{{ tbsitebuild }}/site"
- "{{ tbsitebuild }}/updates.thunderbird.net"
- name: copy built files to tb-website-builds directory
command: "cp -R {{ item.src }} {{ item.dest }}"
with_items:
- { src: "{{ tbsite }}/dist/www.thunderbird.net/.", dest: "{{ tbsitebuild }}/thunderbird.net" }
- { src: "{{ tbsite }}/dist/start.thunderbird.net/.", dest: "{{ tbsitebuild }}/site" }
- { src: "{{ tbsite }}/dist/updates.thunderbird.net/.", dest: "{{ tbsitebuild }}/updates.thunderbird.net" }
- { src: "{{ tbsite }}/wsgi.py", dest: "{{ tbsitebuild }}/wsgi.py" }
- { src: "{{ tbsite }}/settings.py", dest: "{{ tbsitebuild }}/settings.py" }
- name: commit website changes
command: "{{ item }}"
args:
chdir: "{{ tbsitebuild }}"
with_items:
- "git add -A"
- "git -c 'user.name=Thundernest Bot' -c 'user.email={{ lookup('env', 'GIT_EMAIL') }}' commit -m 'Website rebuild triggered by {{ message | default('manual execution of the script.') }}'"
- name: push website update
command: "git push https://{{ lookup('env', 'GIT_USER') | urlencode }}:{{ lookup('env', 'GIT_API_KEY') }}@github.com/thunderbird/tb-website-builds.git --all"
args:
chdir: "{{ tbsitebuild }}"
- name: clean up temporary site files
file:
path: "{{ item }}"
state: absent
with_items:
- "{{ tbsite }}"
- "{{ tbsitebuild }}"