gitea_custom_theme (#24)
Allows the possibility to deploy custom theme with forgejo. You can test it with this https://git.disroot.org/Disroot-themes/forgejo-beetroot for example. Co-authored-by: meaz <meaz@disroot.org> Co-authored-by: muppeth <muppeth@disroot.org> Reviewed-on: Disroot-Ansible/gitea#24 Reviewed-by: muppeth <muppeth@no-reply@disroot.org>
This commit is contained in:
parent
b33011ed8c
commit
35276dc6f3
5 changed files with 71 additions and 2 deletions
|
@ -24,3 +24,7 @@ gitea_download_url: 'https://github.com/go-gitea/gitea/releases/download/v{{ git
|
||||||
## Playbook
|
## Playbook
|
||||||
The playbook includes postgresql role and deploys entire stack needed to run Gitea. Additional roles are also available in the Ansible roles repos in git.
|
The playbook includes postgresql role and deploys entire stack needed to run Gitea. Additional roles are also available in the Ansible roles repos in git.
|
||||||
|
|
||||||
|
## Customization
|
||||||
|
Check https://docs.gitea.io/en-us/customizing-gitea/
|
||||||
|
|
||||||
|
You can deploy custom themes with this role. To do so, check `gitea_custom_themes` var and add your theme's repo address there. The root path of the theme repo must have a `css` folder that includes the theme's css files. You can check https://git.disroot.org/Disroot-themes/forgejo-beetroot as an example.
|
||||||
|
|
|
@ -11,8 +11,14 @@ gitea_version: '1.18.3-2'
|
||||||
gitea_arch: 'linux-amd64'
|
gitea_arch: 'linux-amd64'
|
||||||
#gitea_download_url: 'https://github.com/go-gitea/gitea/releases/download/v{{ gitea_version }}/gitea-{{ gitea_version }}-{{ gitea_arch }}'
|
#gitea_download_url: 'https://github.com/go-gitea/gitea/releases/download/v{{ gitea_version }}/gitea-{{ gitea_version }}-{{ gitea_arch }}'
|
||||||
|
|
||||||
#[CONFIG]
|
#Uncomment below if you want to add custom themes
|
||||||
|
#gitea_theme_dir: '{{ gitea_lib_dir }}/custom'
|
||||||
|
#gitea_custom_themes:
|
||||||
|
# - name: 'beetroot' #add name of the theme
|
||||||
|
# repo: 'https://git.disroot.org/Disroot-themes/forgejo-beetroot.git' #add git repository of the theme
|
||||||
|
# img: 'true' #set it to true if there is an img folder
|
||||||
|
|
||||||
|
#[CONFIG]
|
||||||
# App.ini file variables
|
# App.ini file variables
|
||||||
gitea_base_config:
|
gitea_base_config:
|
||||||
- 'APP_NAME = Gitea: Git with a cup of tea'
|
- 'APP_NAME = Gitea: Git with a cup of tea'
|
||||||
|
@ -23,7 +29,7 @@ gitea_oauth2_config:
|
||||||
- 'JWT_SECRET = ' #41 random chars
|
- 'JWT_SECRET = ' #41 random chars
|
||||||
|
|
||||||
gitea_ui_config:
|
gitea_ui_config:
|
||||||
- 'THEMES = auto,arc-green,gitea'
|
- 'THEMES = auto,arc-green,gitea,beetroot-auto,beetroot-light,beetroot-dark,'
|
||||||
- 'DEFAULT_THEME = arc-green'
|
- 'DEFAULT_THEME = arc-green'
|
||||||
|
|
||||||
gitea_security_config:
|
gitea_security_config:
|
||||||
|
|
|
@ -42,3 +42,5 @@
|
||||||
dest: "{{ gitea_confdir }}"
|
dest: "{{ gitea_confdir }}"
|
||||||
owner: "{{ gitea_user }}"
|
owner: "{{ gitea_user }}"
|
||||||
group: "{{ gitea_group }}"
|
group: "{{ gitea_group }}"
|
||||||
|
notify: Restart gitea
|
||||||
|
tags: config
|
51
tasks/custom_themes.yml
Normal file
51
tasks/custom_themes.yml
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
- name: '[THEME] - Create public dir'
|
||||||
|
file:
|
||||||
|
path: '{{ gitea_lib_dir }}/custom/public/'
|
||||||
|
state: directory
|
||||||
|
owner: "{{ gitea_user }}"
|
||||||
|
group: "{{ gitea_group }}"
|
||||||
|
tags: theme
|
||||||
|
|
||||||
|
- name: "[THEME] - Get repo"
|
||||||
|
git:
|
||||||
|
repo: "{{ item.repo }}"
|
||||||
|
dest: "{{ gitea_theme_dir }}/{{ item.name }}"
|
||||||
|
loop: "{{ gitea_custom_themes }}"
|
||||||
|
tags: theme
|
||||||
|
|
||||||
|
- name: "[THEME] - Sync css folder"
|
||||||
|
synchronize:
|
||||||
|
src: "{{ gitea_theme_dir }}/{{ item.name }}/css/"
|
||||||
|
dest: "{{ gitea_lib_dir }}/custom/public/css"
|
||||||
|
owner: yes
|
||||||
|
group: yes
|
||||||
|
recursive: yes
|
||||||
|
delete: false
|
||||||
|
delegate_to: "{{ inventory_hostname }}"
|
||||||
|
loop: "{{ gitea_custom_themes }}"
|
||||||
|
tags: theme
|
||||||
|
|
||||||
|
- name: "[THEME] - Sync img folder"
|
||||||
|
synchronize:
|
||||||
|
src: "{{ gitea_theme_dir }}/{{ item.name }}/img/"
|
||||||
|
dest: "{{ gitea_lib_dir }}/custom/public/img"
|
||||||
|
owner: yes
|
||||||
|
group: yes
|
||||||
|
recursive: yes
|
||||||
|
delete: false
|
||||||
|
delegate_to: "{{ inventory_hostname }}"
|
||||||
|
when: item.img == "true"
|
||||||
|
loop: "{{ gitea_custom_themes }}"
|
||||||
|
tags: theme
|
||||||
|
|
||||||
|
- name: "[THEME] - Change repo ownership"
|
||||||
|
file:
|
||||||
|
path: "{{ gitea_lib_dir }}/custom"
|
||||||
|
state: directory
|
||||||
|
recurse: yes
|
||||||
|
owner: "{{ gitea_user }}"
|
||||||
|
group: "{{ gitea_group }}"
|
||||||
|
tags: theme
|
||||||
|
|
|
@ -5,6 +5,12 @@
|
||||||
|
|
||||||
- name: "[GITEA] - configure"
|
- name: "[GITEA] - configure"
|
||||||
include_tasks: configure.yml
|
include_tasks: configure.yml
|
||||||
|
tags: config
|
||||||
|
|
||||||
|
- name: "[GITEA] - theme"
|
||||||
|
include_tasks: custom_themes.yml
|
||||||
|
when: gitea_custom_themes is defined
|
||||||
|
tags: theme
|
||||||
|
|
||||||
- name: "[GITEA] - systemd"
|
- name: "[GITEA] - systemd"
|
||||||
include_tasks: systemd.yml
|
include_tasks: systemd.yml
|
||||||
|
|
Loading…
Reference in a new issue