-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.yml
More file actions
65 lines (58 loc) · 1.86 KB
/
Copy pathmain.yml
File metadata and controls
65 lines (58 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
---
- name: Install build dependencies for GitHub CLI
apt:
name:
- ca-certificates
- git
- make
- build-essential
state: present
update_cache: true
- name: Refresh system CA certificates
command: update-ca-certificates
changed_when: false
- name: Check if gh is already installed and matches version
command: gh --version
register: gh_current_version
failed_when: false
changed_when: false
- name: Create build directory
file:
path: "{{ gh_build_dir }}"
state: directory
when: gh_current_version.rc != 0 or gh_release_version not in gh_current_version.stdout
- name: Clone GitHub CLI repository
git:
repo: "{{ gh_git_repo }}"
dest: "{{ gh_build_dir }}"
version: "{{ gh_version }}"
depth: 1
update: true
when: gh_current_version.rc != 0 or gh_release_version not in gh_current_version.stdout
- name: Build and Install GitHub CLI from source
become: true
shell: |
export PATH=$PATH:/usr/local/go/bin
make
make install prefix=/usr/local
args:
chdir: "{{ gh_build_dir }}"
executable: /bin/bash
environment:
SSL_CERT_FILE: /etc/ssl/certs/ca-certificates.crt
SSL_CERT_DIR: /etc/ssl/certs
GIT_SSL_CAINFO: /etc/ssl/certs/ca-certificates.crt
# Prefer the public Go module proxy/checksum database for reproducible
# module zips. Using GOPROXY=direct can expose source archive drift and
# a poisoned root module cache as checksum mismatches.
GOPROXY: "https://proxy.golang.org,direct"
GOMODCACHE: "{{ gh_build_dir }}/.gomodcache"
GOCACHE: "{{ gh_build_dir }}/.gocache"
when: gh_current_version.rc != 0 or gh_release_version not in gh_current_version.stdout
- name: Verify gh installation
command: gh --version
register: gh_verify
changed_when: false
- name: Show gh version
debug:
msg: "GitHub CLI installed: {{ gh_verify.stdout_lines[0] }}"