expirment with gh releases

This commit is contained in:
Morgan McMillian 2024-10-14 20:10:59 -07:00
parent 5c0a1e9bc5
commit 55e913178d
7 changed files with 199 additions and 0 deletions

View file

@ -1,6 +1,12 @@
#!/bin/bash #!/bin/bash
# This script is assuming you've installed Fedora Sway Atomic (sericea) # This script is assuming you've installed Fedora Sway Atomic (sericea)
#
# Show all available branches
# $ ostree remote refs fedora | grep sericea | grep $(uname -m)
#
# Rebase
# $ rpm-ostree rebase fedora:fedora/41/aarch64/sericea
# Add addtional RPM repos # Add addtional RPM repos
cd /etc/yum.repos.d || exit 1 cd /etc/yum.repos.d || exit 1

View file

@ -0,0 +1,33 @@
#!/bin/bash
# This script is assuming you've installed Fedora Sway Atomic (sericea)
#
# Show all available branches
# $ ostree remote refs fedora | grep sericea | grep $(uname -m)
#
# Rebase
# $ rpm-ostree rebase fedora:fedora/41/aarch64/sericea
# Add addtional RPM repos
cd /etc/yum.repos.d || exit 1
sudo wget https://pkgs.tailscale.com/stable/fedora/tailscale.repo
# Add flatpak repos
sudo flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
rpm-ostree override remove firefox firefox-langpacks
rpm-ostree install \
distrobox \
tailscale \
syncthing \
ansible
sudo flatpak install -y \
io.gitlab.librewolf-community \
org.kde.kate
# The following may be needed
#
echo
echo "REBOOT NOW! (systemctl reboot)"
echo

39
github-bin/doctl.yml Normal file
View file

@ -0,0 +1,39 @@
- name: "Discover the latest {{ gh_project }} release from GitHub"
community.general.github_release:
user: "{{ gh_user }}"
repo: "{{ gh_project }}"
action: latest_release
register: release_latest
- name: Set the release version strings
ansible.builtin.set_fact:
release_latest_tag: "{{ release_latest['tag'] }}"
release_latest_trim: "{{ release_latest['tag'] | regex_replace('^v','') }}"
- name: Set the checksum filename
ansible.builtin.set_fact:
release_checksum: "{{ gh_project }}-{{ release_latest_trim }}-checksums.sha256"
- name: Set the release download filename for aarch64
ansible.builtin.set_fact:
release_filename: "{{ gh_project }}-{{ release_latest_trim }}-linux-arm64.tar.gz"
when: ansible_facts['architecture'] == "aarch64"
- name: Set the release download filename for x86_64
ansible.builtin.set_fact:
release_filename: "{{ gh_project }}-{{ release_latest_trim }}-linux-amd64.tar.gz"
when: ansible_facts['architecture'] == "x86_64"
- name: Check if the release was previously downloaded
ansible.builtin.stat:
path: "{{ gh_bin_dir }}/{{ release_filename }}"
register: release_local
- name: "Download the latest {{ gh_project }} release from GitHub"
ansible.builtin.get_url:
url: "https://github.com/{{ gh_user }}/{{ gh_project }}/releases/download/{{ release_latest_tag }}/{{ release_filename }}"
dest: "{{ gh_bin_dir }}"
mode: "0644"
checksum: sha256:https://github.com/{{ gh_user }}/{{ gh_project }}/releases/download/{{ release_latest['tag'] }}/{{ release_checksum }}
when: not release_local.stat.exists
notify: "archive updated"

44
github-bin/main.yml Normal file
View file

@ -0,0 +1,44 @@
---
- name: Update utilities from GitHub
hosts: 127.0.0.1
connection: local
vars:
home_dir: "{{ ansible_facts['env']['HOME'] }}"
gh_bin_dir: "{{ home_dir }}/ghbin"
tasks:
- name: Setup GitHub bin locaiton
ansible.builtin.file:
path: "{{ gh_bin_dir }}"
state: directory
mode: "0755"
- name: doctl
ansible.builtin.include_tasks: doctl.yml
vars:
gh_user: digitalocean
gh_project: doctl
- name: starship
ansible.builtin.include_tasks: starship.yml
vars:
gh_user: starship
gh_project: starship
- name: marksman
ansible.builtin.include_tasks: marksman.yml
vars:
gh_user: artempyanykh
gh_project: marksman
handlers:
- name: "archive updated"
ansible.builtin.unarchive:
src: "{{ gh_bin_dir }}/{{ release_filename }}"
dest: "{{ home_dir }}/bin"
- name: "marksman updated"
ansible.builtin.copy:
src: "{{ gh_bin_dir }}/{{ release_filename }}-{{ release_latest_tag }}"
dest: "{{ home_dir }}/bin/marksman"
mode: "0755"

34
github-bin/marksman.yml Normal file
View file

@ -0,0 +1,34 @@
- name: "Discover the latest {{ gh_project }} release from GitHub"
community.general.github_release:
user: "{{ gh_user }}"
repo: "{{ gh_project }}"
action: latest_release
register: release_latest
- name: Set the release version strings
ansible.builtin.set_fact:
release_latest_tag: "{{ release_latest['tag'] }}"
- name: Set the release download filename for aarch64
ansible.builtin.set_fact:
release_filename: "{{ gh_project }}-linux-arm64"
when: ansible_facts['architecture'] == "aarch64"
- name: Set the release download filename for x86_64
ansible.builtin.set_fact:
release_filename: "{{ gh_project }}-linux-x64"
when: ansible_facts['architecture'] == "x86_64"
- name: Check if the release was previously downloaded
ansible.builtin.stat:
path: "{{ gh_bin_dir }}/{{ release_filename }}-{{ release_latest_tag }}"
register: release_local
- name: "Download the latest {{ gh_project }} release from GitHub"
ansible.builtin.get_url:
url: "https://github.com/{{ gh_user }}/{{ gh_project }}/releases/download/{{ release_latest_tag }}/{{ release_filename }}"
dest: "{{ gh_bin_dir }}/{{ release_filename }}-{{ release_latest_tag }}"
mode: "0644"
# checksum: sha256:https://github.com/{{ gh_user }}/{{ gh_project }}/releases/download/{{ release_latest['tag'] }}/{{ release_checksum }}
when: not release_local.stat.exists
notify: "marksman updated"

36
github-bin/starship.yml Normal file
View file

@ -0,0 +1,36 @@
- name: "Discover the latest {{ gh_project }} release from GitHub"
community.general.github_release:
user: "{{ gh_user }}"
repo: "{{ gh_project }}"
action: latest_release
register: release_latest
- name: Set the release version strings
ansible.builtin.set_fact:
release_latest_tag: "{{ release_latest['tag'] }}"
- name: Set the release download filenames for aarch64
ansible.builtin.set_fact:
release_filename: "{{ gh_project }}-aarch64-unknown-linux-musl.tar.gz"
release_checksum: "{{ gh_project }}-aarch64-unknown-linux-musl.tar.gz.sha256"
when: ansible_facts['architecture'] == "aarch64"
- name: Set the release download filenames for x86_64
ansible.builtin.set_fact:
release_filename: "{{ gh_project }}-x86_64-unknown-linux-musl.tar.gz"
release_checksum: "{{ gh_project }}-x86_64-unknown-linux-musl.tar.gz.sha256"
when: ansible_facts['architecture'] == "x86_64"
- name: Check if the release was previously downloaded
ansible.builtin.stat:
path: "{{ gh_bin_dir }}/{{ release_filename }}"
register: release_local
- name: "Download the latest {{ gh_project }} release from GitHub"
ansible.builtin.get_url:
url: "https://github.com/{{ gh_user }}/{{ gh_project }}/releases/download/{{ release_latest_tag }}/{{ release_filename }}"
dest: "{{ gh_bin_dir }}"
mode: "0644"
checksum: sha256:https://github.com/{{ gh_user }}/{{ gh_project }}/releases/download/{{ release_latest['tag'] }}/{{ release_checksum }}
when: not release_local.stat.exists
notify: "archive updated"

7
github-bin/update.sh Executable file
View file

@ -0,0 +1,7 @@
#!/bin/bash
# ansible-playbook doctl.yml
# ansible-playbook starship.yml
# ansible-playbook marksman.yml
ansible-playbook main.yml