Add variable for deno version.

This commit is contained in:
Brian Lee 2024-11-11 12:00:21 -08:00
parent 79e90392d4
commit 3518f6c96c
3 changed files with 18 additions and 11 deletions

View File

@ -1,4 +1,5 @@
---
deno_version: latest
strfry_version: beta
strfry_binary_path: /usr/local/bin/strfry
strfry_make_jobs: "{{ ansible_processor_cores }}"

View File

@ -10,20 +10,25 @@
path: /etc/ansible/facts.d
state: directory
- name: 'Detect the latest Deno version'
- name: Fetch latest Deno version if 'latest' is specified
ansible.builtin.uri:
url: https://api.github.com/repos/denoland/deno/releases/latest
register: deno_latest_release_tag
register: deno_latest_release
when: deno_version == 'latest'
- name: 'Determine whether or not the latest version of Deno is already installed'
- name: Set actual Deno version
ansible.builtin.set_fact:
install_deno: "{{ (ansible_local.deno is not defined) or \
((ansible_local.deno is defined) and \
(ansible_local['deno']['settings']['version'] != deno_latest_release_tag.json.tag_name | replace('v',''))) }}"
actual_deno_version: "{{ deno_latest_release.json.tag_name | replace('v','') if deno_version == 'latest' else deno_version }}"
- name: 'Ensure Deno is installed'
- name: Determine whether or not the specified version of Deno is already installed
ansible.builtin.set_fact:
install_deno: "{{ (ansible_local.deno is not defined) or
((ansible_local.deno is defined) and
(ansible_local['deno']['settings']['version'] != actual_deno_version)) }}"
- name: Ensure Deno is installed
unarchive:
src: 'https://github.com/denoland/deno/releases/download/{{ deno_latest_release_tag.json.tag_name }}/deno-x86_64-unknown-linux-gnu.zip'
src: "https://github.com/denoland/deno/releases/download/v{{ actual_deno_version }}/deno-x86_64-unknown-linux-gnu.zip"
dest: /usr/local/bin
mode: 0755
remote_src: true
@ -31,13 +36,13 @@
- -j
when: install_deno
- name: 'Save meta information about the version of Deno that was installed'
- name: Save meta information about the version of Deno that was installed
community.general.ini_file:
path: /etc/ansible/facts.d/deno.fact
mode: 0644
section: settings
option: version
value: "{{ deno_latest_release_tag.json.tag_name | replace('v','') }}"
value: "{{ actual_deno_version }}"
backup: true
no_extra_spaces: true
when: install_deno

View File

@ -18,6 +18,7 @@
apply:
become: true
when: strfry_policies_enabled
tags: deno
- name: Install build dependencies
ansible.builtin.package: