diff --git a/README.md b/README.md index 9e08c62..3156d65 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ The playbook includes postgresql role and deploys entire stack needed to run For ## Customization You can deploy custom themes with this role. To do so, uncomment `forgejo_theme_dir` and `forgejo_custom_themes` from `defaults/main.yml`. Add the theme repos' address and name there, enable them and then deploy with `ansible-playbook -b Playbooks/forgejo.yml --tags theme`. -You can also add you own images like favicon, icons, etc. See https://docs.gitea.io/en-us/customizing-gitea/ to see how to prepare your images. +You can also add you own images like favicon, icons, etc. See https://forgejo.org/docs/v1.21/developer/customization/ to see how to prepare your images. Then, copy them in the `img` folder of this role and uncomment `forgejo_extra_files_path` and `forgejo_theme_dir` from `defaults/main.yml`. You can then deploy with `ansible-playbook -b Playbooks/forgejo.yml --tags config`. -For more information about customizaton, check https://docs.gitea.io/en-us/customizing-gitea/. +For more information about customizaton, check https://forgejo.org/docs/v1.21/developer/customization/ diff --git a/defaults/main.yml b/defaults/main.yml index 4f4106b..421bde9 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -7,7 +7,7 @@ forgejo_group: 'git' forgejo_confdir: '/etc/forgejo/app.ini' forgejo_flavor: 'forgejo' -forgejo_version: '1.20.6-0' +forgejo_version: '1.21.1-0' forgejo_arch: 'linux-amd64' #forgejo_download_url: 'https://github.com/go-gitea/gitea/releases/download/v{{ forgejo_version }}/gitea-{{ forgejo_version }}-{{ forgejo_arch }}' diff --git a/tasks/configure.yml b/tasks/configure.yml index 6e36ed2..b76b6dd 100644 --- a/tasks/configure.yml +++ b/tasks/configure.yml @@ -45,9 +45,18 @@ notify: Restart forgejo tags: config +- name: "[CONF] - Create assets dir" + file: + path: "{{ forgejo_theme_dir }}/public/assets/" + state: 'directory' + owner: '{{ forgejo_user }}' + group: '{{ forgejo_group }}' + when: forgejo_extra_files_path is defined + tags: config + - name: "[CONF] - Create img folder" file: - path: "{{ forgejo_theme_dir }}/public/img/" + path: "{{ forgejo_theme_dir }}/public/assets/img/" state: 'directory' owner: '{{ forgejo_user }}' group: '{{ forgejo_group }}' @@ -57,7 +66,7 @@ - name: "[CONF] - Deploy img folder" copy: src: '{{ forgejo_extra_files_path }}/' - dest: "{{ forgejo_theme_dir }}/public/img/" + dest: "{{ forgejo_theme_dir }}/public/assets/img/" owner: "{{ forgejo_user }}" group: "{{ forgejo_group }}" mode: 0755 diff --git a/tasks/custom_themes.yml b/tasks/custom_themes.yml index f794e20..99c9bf5 100644 --- a/tasks/custom_themes.yml +++ b/tasks/custom_themes.yml @@ -1,16 +1,8 @@ --- -- name: '[THEME] - Create public dir' - file: - path: '{{ forgejo_theme_dir }}/public/' - state: directory - owner: "{{ forgejo_user }}" - group: "{{ forgejo_group }}" - tags: theme - - name: '[THEME] - Create css dir' file: - path: '{{ forgejo_theme_dir }}/public/css' + path: '{{ forgejo_theme_dir }}/public/assets/css' state: directory owner: "{{ forgejo_user }}" group: "{{ forgejo_group }}" @@ -19,7 +11,7 @@ # First, remove the css files from public folder, then theme repos - name: "[THEME] - Remove css files from the css folder" shell: - cmd: find "{{ forgejo_theme_dir }}/{{ item.name }}" -type f -name "*.css" -printf "%f\n" | xargs -I{} rm public/css/{} + cmd: find "{{ forgejo_theme_dir }}/{{ item.name }}" -type f -name "*.css" -printf "%f\n" | xargs -I{} rm public/assets/css/{} chdir: "{{ forgejo_theme_dir }}" loop: "{{ forgejo_custom_themes }}" when: item.enable == 'false' @@ -49,7 +41,7 @@ - name: "[THEME] - Find css files from different repos and copy them in the public folder" shell: - cmd: find "{{ forgejo_theme_dir }}" -type f -name "*.css" -not -path "{{ forgejo_theme_dir }}/public/*" | xargs cp -t "{{ forgejo_theme_dir }}/public/css" + cmd: find "{{ forgejo_theme_dir }}" -type f -name "*.css" -not -path "{{ forgejo_theme_dir }}/public/*" | xargs cp -t "{{ forgejo_theme_dir }}/public/assets/css" chdir: "{{ forgejo_theme_dir }}" become: true become_user: "{{ forgejo_user }}" @@ -58,7 +50,7 @@ # Lastly, update app.ini by adding the theme's name list. - name: "[THEME] - Get and prepare a list for app.ini of css files in public folder, register it" shell: - cmd: ls "{{ forgejo_theme_dir }}/public/css" | sed -e 's/theme-//g' | sed -e 's/.css//g' | paste -s -d, + cmd: ls "{{ forgejo_theme_dir }}/public/assets/css" | sed -e 's/theme-//g' | sed -e 's/.css//g' | paste -s -d, chdir: "{{ forgejo_theme_dir }}" register: theme_name tags: theme