From a732d371578668ae21897cad1b729f3cccf5d1f0 Mon Sep 17 00:00:00 2001 From: Aleksana <42209822+Aleksanaa@users.noreply.github.com> Date: Sat, 13 Aug 2022 19:33:15 +0800 Subject: [PATCH 1/3] Add a new workflow --- .github/workflows/arch_package.yml | 68 ++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 .github/workflows/arch_package.yml diff --git a/.github/workflows/arch_package.yml b/.github/workflows/arch_package.yml new file mode 100644 index 00000000..66f6b2eb --- /dev/null +++ b/.github/workflows/arch_package.yml @@ -0,0 +1,68 @@ +name: arch_package + +on: + release: + types: [created] + +jobs: + build: + runs-on: ubuntu-latest + container: + image: archlinux + options: --privileged + volumes: + - /sys/fs/cgroup:/sys/fs/cgroup + + steps: + - name: Prepare environment + run: | + pacman -Syu --needed --noconfirm base-devel git openssh + sed -i '/E_ROOT/d' /usr/bin/makepkg + + - name: Import AUR key + run: | + mkdir ~/.ssh && chmod 700 ~/.ssh + echo '${{secrets.AUR_SSH_PRIVATE_KEY}}' >> ~/.ssh/id_rsa + chmod 600 ~/.ssh/id_rsa + ssh-keyscan -H aur.archlinux.org >> /etc/ssh/ssh_known_hosts + + - name: Clone from AUR + run: | + export GIT_SSH_COMMAND='ssh -i ~/.ssh/id_rsa' + git clone ssh://aur@aur.archlinux.org/hyfetch.git + + - name: Upgrade PKGBUILD + run: | + cd hyfetch + sed -i "/^pkgver=/cpkgver=${{github.ref_name}}" PKGBUILD + sed -i "/^pkgrel=/cpkgrel=1" PKGBUILD + + - name: Makepkg + run: | + cd hyfetch + yes | makepkg -si + + - name: Test hyfetch + run: | + hyfetch --test-print + + - name: Upload binaries to release + uses: shogo82148/actions-upload-release-asset@v1 + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: hyfetch/hyfetch*.pkg.tar.* + + - name: set git info + run: | + git config --global user.name "Aleksana QwQ" + git config --global user.email "me@aleksana.moe" + + - name: Update PKGBUILD to AUR + run: | + cd hyfetch + rm -r .SRCINFO && makepkg --srcinfo >.SRCINFO + git stage . && git commit -m "BOT: upgrade to ${{github.ref_name}}" + export GIT_SSH_COMMAND='ssh -i ~/.ssh/id_rsa' + git push + + From 3cc8a6cf0102de7c9dbb5c0c06a43005eff8cb56 Mon Sep 17 00:00:00 2001 From: Aleksana <42209822+Aleksanaa@users.noreply.github.com> Date: Sat, 13 Aug 2022 21:20:37 +0800 Subject: [PATCH 2/3] Change my name --- .github/workflows/arch_package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/arch_package.yml b/.github/workflows/arch_package.yml index 66f6b2eb..d8d93307 100644 --- a/.github/workflows/arch_package.yml +++ b/.github/workflows/arch_package.yml @@ -54,7 +54,7 @@ jobs: - name: set git info run: | - git config --global user.name "Aleksana QwQ" + git config --global user.name "Aleksana BOT" git config --global user.email "me@aleksana.moe" - name: Update PKGBUILD to AUR From c431695eee8b4c72786ab1609fa262ada65415c9 Mon Sep 17 00:00:00 2001 From: Aleksana <42209822+Aleksanaa@users.noreply.github.com> Date: Sat, 13 Aug 2022 22:35:02 +0800 Subject: [PATCH 3/3] Add another user Add another user to avoid ssh keys being stolen by malicious code --- .github/workflows/arch_package.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/arch_package.yml b/.github/workflows/arch_package.yml index d8d93307..dc031d1c 100644 --- a/.github/workflows/arch_package.yml +++ b/.github/workflows/arch_package.yml @@ -17,7 +17,7 @@ jobs: - name: Prepare environment run: | pacman -Syu --needed --noconfirm base-devel git openssh - sed -i '/E_ROOT/d' /usr/bin/makepkg + useradd buildbot - name: Import AUR key run: | @@ -40,11 +40,11 @@ jobs: - name: Makepkg run: | cd hyfetch - yes | makepkg -si + su buildbot -c "yes | makepkg -si" - name: Test hyfetch run: | - hyfetch --test-print + su buildbot -c "hyfetch --test-print" - name: Upload binaries to release uses: shogo82148/actions-upload-release-asset@v1