Skip to content

Commit

Permalink
fix: updated how nvm is installed
Browse files Browse the repository at this point in the history
  • Loading branch information
SilasPeters committed Jul 8, 2024
1 parent 4fe6b5d commit 9ea80e9
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
1 change: 1 addition & 0 deletions ansible/roles/execut/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
repo: "https://github.com/stichtingsticky/execut"
dest: "{{ execut_website_path }}"
version: "main"
diff: false

# FIXME update pnpm in symposium
- name: "run pnpm install"
Expand Down
25 changes: 18 additions & 7 deletions ansible/roles/radio/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,34 @@
---
- name: "clone NVM"
- name: "clone nvm"
listen: "radio repo updated"
become_user: "radio"
become: true
ansible.builtin.git:
repo: "https://github.com/nvm-sh/nvmrc.git"
repo: "https://github.com/nvm-sh/nvm.git"
dest: "/var/www/radio/.nvm"
depth: 1
# branch name
version: main
recursive: false # cloning submodules fails, but they are purely for testing
diff: false

- name: "checkout latest nvm version" # based on nvm manual installation guide
listen: "radio repo updated"
become_user: "radio"
become: true
ansible.builtin.shell:
cmd: git checkout `git describe --abbrev=0 --tags --match "v[0-9]*" $(git rev-list --tags --max-count=1)`
chdir: "/var/www/radio/.nvm"
executable: "/bin/bash"
tags:
- skip_ansible_lint
# Reason: linter wants us to use the git module, but that can't do this
# complicated stuff

- name: "install node version"
listen: "radio repo updated"
become_user: "radio"
become: true
ansible.builtin.shell: |
source /var/www/radio/.nvm/nvm.sh
nvm install
nvm install $(cat /var/www/radio/radio/.nvmrc)
args:
chdir: "/var/www/radio/radio"
executable: "/bin/bash"
Expand All @@ -29,7 +40,7 @@
become: true
ansible.builtin.shell: |
source /var/www/radio/.nvm/nvm.sh
nvm use || nvm install $(cat /var/www/radio/radio/.nvmrc)
nvm use
npm rebuild
args:
chdir: "/var/www/radio/radio"
Expand Down
4 changes: 2 additions & 2 deletions ansible/roles/radio/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
- name: "run npm install"
ansible.builtin.shell: |
source /var/www/radio/.nvm/nvm.sh
nvm use || nvm install $(cat /var/www/radio/radio/.nvmrc)
nvm use
npm install
args:
chdir: "/var/www/radio/radio"
Expand All @@ -65,7 +65,7 @@
- name: "build website"
ansible.builtin.shell: |
source /var/www/radio/.nvm/nvm.sh
nvm use || nvm install $(cat /var/www/radio/radio/.nvmrc)
nvm use
npm run build
args:
chdir: "/var/www/radio/radio"
Expand Down

0 comments on commit 9ea80e9

Please sign in to comment.