From 15246ebc677a600b7cdaa1a83f8c1602440e48e0 Mon Sep 17 00:00:00 2001 From: Andrey Onishchenko Date: Fri, 2 Feb 2024 18:45:51 +0300 Subject: [PATCH] Update packages script fix fix fix d f --- .github/workflows/build.yml | 2 +- .github/workflows/update_packages.sh | 23 ++++++++++++++++ .github/workflows/update_packages.yml | 39 +++++++++++++++++++++++++++ 3 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/update_packages.sh create mode 100644 .github/workflows/update_packages.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 928f236..630c1dc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,7 +6,7 @@ on: - '*' push: branches: - - 'master' + - '#master' jobs: diff --git a/.github/workflows/update_packages.sh b/.github/workflows/update_packages.sh new file mode 100644 index 0000000..7c8b11c --- /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 -S --noconfirm git sudo base-devel jq nix + sh ./generate_packages.sh + git config --global --add safe.directory "*" + ;; + *) + echo "Operating system is not recognized." + ;; +esac \ No newline at end of file diff --git a/.github/workflows/update_packages.yml b/.github/workflows/update_packages.yml new file mode 100644 index 0000000..a41f397 --- /dev/null +++ b/.github/workflows/update_packages.yml @@ -0,0 +1,39 @@ +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: + strategy: + matrix: + container: + - archlinux:latest + runs-on: ubuntu-latest + container: + image: ${{ matrix.container }} + steps: + - name: Pacman database update + run: pacman -Syy --noconfirm + - name: Fix Git + run: pacman -S --noconfirm git + - name: Checkout + uses: actions/checkout@v4 + - 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