From a2b34421b34861e0994f8b6cd90def82ba3036ef Mon Sep 17 00:00:00 2001 From: meaz Date: Wed, 13 Dec 2023 20:12:37 +0000 Subject: [PATCH] v1.21.2-0 (#39) Reviewed-on: https://git.disroot.org/Disroot-Ansible/forgejo/pulls/39 Reviewed-by: muppeth Co-authored-by: meaz Co-committed-by: meaz --- README.md | 6 ++++-- defaults/main.yml | 2 +- tasks/configure.yml | 13 +++++++++++-- tasks/custom_themes.yml | 16 ++++------------ 4 files changed, 20 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 9e08c62..a2cdd8f 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,8 @@ You can deploy test instance using `Vagrantfile` attached to the role. Then you can then access forgejo from your computer on `http://192.168.33.14:3000` +The first user you create becomes the admin. + # Gitea or Forgejo This role allows for deployment of gitea and forgejo. By default the role deploys forgejo and this is the flavor that is supported and maintained. Installing Gitea using the role is possible however starting from version 1.18.2 is no longer maintained by Disroot team. To switch to gitea, update following variables in your Playbook/host_vars: @@ -27,7 +29,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..4467ac8 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.2-1' 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