blob: 546a4f008efbce7331442cef06c5372624dd73a0 (
plain) (
blame)
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
|
---
- name: Set up user
include_role:
name: user
- name: Install SSH key for EmacsConf wiki
ansible.builtin.get_url:
url: https://emacsconf.org/id_rsa_anon_git_emacsconf
dest: "/home/{{ emacsconf_user }}/.ssh/id_rsa_anon_git_emacsconf"
owner: "{{ emacsconf_user }}"
group: "{{ emacsconf_group }}"
mode: '0600'
- name: Install the SSH key for orga
copy:
src: "{{ item }}"
dest: "/home/{{ emacsconf_user }}/.ssh"
owner: "{{ emacsconf_user }}"
group: "{{ emacsconf_group }}"
mode: '0600'
loop:
- id_rsa
- id_rsa.pub
- name: Check if local Emacs already exists
stat:
path: "/usr/local/bin/emacs"
register: emacs
- name: Set up Emacs
become: yes
import_tasks: emacs.yml
when: not emacs.stat.exists
- name: Configure git
template:
src: git-config
dest: "~{{ emacsconf_user }}/.gitconfig"
owner: "{{ emacsconf_user }}"
group: "{{ emacsconf_group }}"
- name: Ensure configuration directory exists
file:
path: "{{ emacs_config_dir }}"
owner: "{{ emacsconf_user }}"
group: "{{ emacsconf_group }}"
state: directory
- name: Set up Emacs configuration for non-interactive publishing
template:
src: emacsconf-config.el
dest: "{{ emacs_config_dir }}/emacsconf-config.el"
owner: "{{ emacsconf_user }}"
group: "{{ emacsconf_group }}"
- name: Check if Emacs base configuration already exists
lineinfile:
dest: "{{ emacs_config_dir }}/init.el"
state: present
regexp: "emacsconf-config"
line: "(load-file \"{{ emacs_config_dir }}/emacsconf-config.el\")"
owner: "{{ emacsconf_user }}"
group: "{{ emacsconf_group }}"
create: yes
- name: Set up or update repositories
become_user: "{{ emacsconf_user }}"
tags: publish
block:
- name: Set up compile-media
git:
repo: https://github.com/sachac/compile-media.git
dest: "~{{ emacsconf_user }}/compile-media"
- name: Set up subed
git:
repo: https://github.com/sachac/subed.git
dest: "~{{ emacsconf_user }}/subed"
- name: Check out wiki repository
ansible.builtin.git:
repo: "{{ emacsconf_publishing_source }}"
dest: "{{ emacsconf_edit_wiki_dir }}"
ssh_opts: "-i /home/{{ emacsconf_user }}/.ssh/id_rsa_anon_git_emacsconf"
register: wiki_clone
failed_when:
- wiki_clone.failed
- not 'Local modifications exist in repository' in wiki_clone.msg
- not 'Failed to checkout branch' in wiki_clone.msg
- name: Set up key
shell: git config core.sshCommand "ssh -i ~/.ssh/id_rsa_anon_git_emacsconf -F /dev/null"
args:
chdir: "{{ emacsconf_edit_wiki_dir }}"
- name: Check out emacsconf-el
tags: wip
ansible.builtin.git:
repo: git@git.emacsconf.org:pub/emacsconf-el
key_file: "~{{ emacsconf_user }}/.ssh/id_rsa"
dest: "{{ emacsconf_el_dir }}"
register: elisp
failed_when:
- elisp.failed
- not 'Local modifications exist in repository' in elisp.msg
- not 'Failed to checkout branch' in elisp.msg
debugger: on_failed
- name: Check out emacsconf-{{ emacsconf_year }}-private
ansible.builtin.git:
version: main
repo: "git@git.emacsconf.org:emacsconf-{{ emacsconf_year }}-private"
dest: "{{ emacsconf_private_dir }}"
register: private
failed_when:
- private.failed
- not 'Local modifications exist in repository' in private.msg
- not 'Failed to checkout branch' in private.msg
- name: Change ownership
file:
path: "{{ item }}"
owner: "{{ emacsconf_user }}"
group: "{{ emacsconf_group }}"
recurse: true
loop:
- "{{ emacs_config_dir }}"
- "{{ emacsconf_el_dir }}"
- "{{ emacsconf_private_dir }}"
- "{{ emacsconf_edit_wiki_dir }}"
- name: Publish
tags: publish, publish-only
block:
- name: Publish the schedule
command: emacs -l "{{ emacs_config_dir }}/emacsconf-config.el" --batch --exec '(emacsconf-publish-schedule)'
when: ((publish|d("")) == "schedule") or (((private is defined and private.changed) or (elisp is defined and elisp.changed)) and slug is not defined)
- name: Update a specific talk's nav page
tags: publish-talk
command: emacs -l "{{ emacs_config_dir }}/emacsconf-config.el" --batch --exec '(emacsconf-with-talk-heading "{{ slug }}" (emacsconf-update-talk))'
when: slug is defined
# - name: Commit the wiki and push
# shell: cd {{ emacsconf_edit_wiki_dir }}; git commit -m 'Update from ansible' -a; git push
- name: Publish the backstage index
command: emacsclient -c -nw --exec '(emacsconf-publish-backstage-index)' -a emacs
when: (publish|d("")) == "backstage"
|