From 55e913178dc661663625bc7f9db75366a1dc40e3 Mon Sep 17 00:00:00 2001 From: Morgan McMillian Date: Mon, 14 Oct 2024 20:10:59 -0700 Subject: [PATCH] expirment with gh releases --- fedora-atomic/cosmic-de-setup.sh | 6 ++++ fedora-atomic/sway-atomic-setup.sh | 33 ++++++++++++++++++++++ github-bin/doctl.yml | 39 ++++++++++++++++++++++++++ github-bin/main.yml | 44 ++++++++++++++++++++++++++++++ github-bin/marksman.yml | 34 +++++++++++++++++++++++ github-bin/starship.yml | 36 ++++++++++++++++++++++++ github-bin/update.sh | 7 +++++ 7 files changed, 199 insertions(+) create mode 100755 fedora-atomic/sway-atomic-setup.sh create mode 100644 github-bin/doctl.yml create mode 100644 github-bin/main.yml create mode 100644 github-bin/marksman.yml create mode 100644 github-bin/starship.yml create mode 100755 github-bin/update.sh diff --git a/fedora-atomic/cosmic-de-setup.sh b/fedora-atomic/cosmic-de-setup.sh index e1030f0..f16a638 100755 --- a/fedora-atomic/cosmic-de-setup.sh +++ b/fedora-atomic/cosmic-de-setup.sh @@ -1,6 +1,12 @@ #!/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 diff --git a/fedora-atomic/sway-atomic-setup.sh b/fedora-atomic/sway-atomic-setup.sh new file mode 100755 index 0000000..ff3b862 --- /dev/null +++ b/fedora-atomic/sway-atomic-setup.sh @@ -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 diff --git a/github-bin/doctl.yml b/github-bin/doctl.yml new file mode 100644 index 0000000..3494ca9 --- /dev/null +++ b/github-bin/doctl.yml @@ -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" diff --git a/github-bin/main.yml b/github-bin/main.yml new file mode 100644 index 0000000..29c6c4e --- /dev/null +++ b/github-bin/main.yml @@ -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" diff --git a/github-bin/marksman.yml b/github-bin/marksman.yml new file mode 100644 index 0000000..ea685af --- /dev/null +++ b/github-bin/marksman.yml @@ -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" diff --git a/github-bin/starship.yml b/github-bin/starship.yml new file mode 100644 index 0000000..c523b1e --- /dev/null +++ b/github-bin/starship.yml @@ -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" diff --git a/github-bin/update.sh b/github-bin/update.sh new file mode 100755 index 0000000..87c49af --- /dev/null +++ b/github-bin/update.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +# ansible-playbook doctl.yml +# ansible-playbook starship.yml +# ansible-playbook marksman.yml + +ansible-playbook main.yml