2020-10-12 02:40:15 +00:00
|
|
|
---
|
2020-10-12 20:29:06 +00:00
|
|
|
- name: determine if installed
|
|
|
|
stat:
|
|
|
|
path: "{{ gitea_bin_path }}/gitea"
|
|
|
|
register: st
|
|
|
|
|
|
|
|
- name: set gitea_installed
|
|
|
|
set_fact:
|
2022-08-30 12:13:25 +00:00
|
|
|
gitea_installed: "{{ st.stat.exists | bool }}"
|
2020-10-12 02:40:15 +00:00
|
|
|
|
2020-10-12 20:29:06 +00:00
|
|
|
- block:
|
2020-10-12 02:40:15 +00:00
|
|
|
- name: determine latest version
|
|
|
|
uri:
|
|
|
|
url: https://api.github.com/repos/go-gitea/gitea/releases/latest
|
|
|
|
return_content: true
|
|
|
|
body_format: json
|
|
|
|
register: _latest_version
|
|
|
|
until: _latest_version.status == 200
|
|
|
|
retries: 3
|
|
|
|
|
2020-10-12 21:41:26 +00:00
|
|
|
- name: set gitea_version
|
2020-10-12 20:29:06 +00:00
|
|
|
set_fact:
|
2020-10-12 21:41:26 +00:00
|
|
|
gitea_version: "{{ _latest_version.json['tag_name'] | regex_replace('^v', '') }}"
|
2020-10-12 20:29:06 +00:00
|
|
|
|
|
|
|
- block:
|
2020-10-12 02:40:15 +00:00
|
|
|
- name: determine installed version
|
|
|
|
command: "{{ gitea_bin_path }}/gitea --version"
|
|
|
|
register: _installed_version_string
|
|
|
|
changed_when: false
|
|
|
|
|
2020-10-12 20:29:06 +00:00
|
|
|
- name: set gitea_local_version
|
2020-10-12 02:40:15 +00:00
|
|
|
set_fact:
|
|
|
|
gitea_local_version: "{{ _installed_version_string.stdout | regex_search('^Gitea version ([\\d.]+)', '\\1') | first }}"
|
2020-10-12 20:29:06 +00:00
|
|
|
when: gitea_installed | bool
|
2020-10-12 02:40:15 +00:00
|
|
|
|
2020-10-12 21:41:26 +00:00
|
|
|
- name: set gitea_local_version to 0
|
|
|
|
set_fact:
|
|
|
|
gitea_local_version: "0"
|
2022-08-30 12:13:25 +00:00
|
|
|
when: not (gitea_installed | bool)
|
2020-10-12 21:41:26 +00:00
|
|
|
|
2020-10-12 20:29:06 +00:00
|
|
|
- block:
|
2020-10-12 21:41:26 +00:00
|
|
|
- name: get checksums
|
2020-10-12 02:40:15 +00:00
|
|
|
set_fact:
|
2020-10-12 21:41:26 +00:00
|
|
|
checksum_string: "{{ lookup('url', gitea_url + '.sha256') }}"
|
|
|
|
|
|
|
|
- name: set gitea_checksum
|
|
|
|
set_fact:
|
|
|
|
gitea_checksum: "sha256:{{ checksum_string.split(' ') | first }}"
|