diff --git a/.github/update_packages.yml b/.github/update_packages.yml new file mode 100644 index 0000000..28d1c21 --- /dev/null +++ b/.github/update_packages.yml @@ -0,0 +1,29 @@ +name: Update packages + +# Controls when the action will run. Workflow runs when manually triggered using the UI +# or API. +on: + workflow_dispatch: + +jobs: + update_packages: + runs-on: archlinux:latest + + steps: + - name: Check and update current packages + run: sh .github/workflows/update_packages.sh + - name: Save tag name + run: echo "TAG_NAME=v$(jq -r .version ./version_info.json)" >> $GITHUB_ENV + - name: Save version name (Beta x.x.x) + run: echo "VERSION_NAME=Beta $(jq -r .version ./version_info.json)" >> $GITHUB_ENV + - name: Commit and push changes + uses: EndBug/add-and-commit@v9.1.4 + with: + message: "Update packages to ${{ env.VERSION_NAME }}" + add: "." + author_name: "GitHub Actions" + author_email: "loraner123@gmail.com" + tag: ${{ env.TAG_NAME }} + tag_push: '--force' + + \ No newline at end of file diff --git a/.github/workflows/update_packages.sh b/.github/workflows/update_packages.sh new file mode 100644 index 0000000..7fb091c --- /dev/null +++ b/.github/workflows/update_packages.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +if [ -f /etc/os-release ]; then + . /etc/os-release + OS=$NAME +elif [ -f /etc/lsb-release ]; then + . /etc/lsb-release + OS=$DISTRIB_ID +else + OS=$(uname -s) +fi + +case $OS in + "Arch Linux") + echo "Arch Linux" + pacman -Syy --noconfirm + pacman -S --noconfirm git sudo base-devel jq + sh ./generate_packages.sh + ;; + *) + echo "Operating system is not recognized." + ;; +esac \ No newline at end of file