From d015b5ad104404c78cab2be01717716d5c289b00 Mon Sep 17 00:00:00 2001 From: Erich L Foster Date: Sat, 18 May 2024 14:30:01 +0200 Subject: [PATCH] User docker command directly --- .github/workflows/install-ci.yml | 36 +++++++++++++++++++------------- scripts/utils.sh | 4 ++-- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/.github/workflows/install-ci.yml b/.github/workflows/install-ci.yml index 3372cb4..f5bd027 100644 --- a/.github/workflows/install-ci.yml +++ b/.github/workflows/install-ci.yml @@ -8,26 +8,32 @@ on: - main jobs: install: - container: - image: archlinux:latest - options: --user=root --entrypoint=/bin/bash - env: - SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} - SSH_AUTH_SOCK: ${{ secrets.SSH_AUTH_SOCK }} - volumes: - - /var/run/docker.sock:/var/run/docker.sock - - ${{ github.workspace }}:/workspace runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 - name: Setup ssh - uses: PhutureCorp/container-ssh-agent@v0.0.1 + uses: webfactory/ssh-agent@v0.9.0 with: ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} - - name: install + - name: Install run: | - pacman -Sy --noconfirm sudo openssh git - git config --global --add safe.directory /workspace - cd /workspace - ./install.sh" + docker run --rm \ + -v $SSH_AUTH_SOCK:/ssh-agent \ + -v ~/.ssh/known_hosts:/root/.ssh/known_hosts \ + -e SSH_AUTH_SOCK=/ssh-agent \ + -v ${{ github.workspace }}:/workspace \ + manjarolinux/base:latest \ + /bin/bash -c " + GREEN='\033[0;32'; NC='\033[om' + echo -e '${GREEN}Install openssh and git${NC}' \ + cat /root/.ssh/id_rsa \ + pacman -Sy --noconfirm openssh git && \ + echo -e '${GREEN}Add ssh keys${NC}' \ + ssh-add -l \ + echo -e '${GREEN}Add /workspace to trusted repos${NC}' \ + git config --global --add safe.directory /workspace && \ + echo -e '${GREEN}Start install${NC}' \ + cd /workspace && \ + ./install.sh + " diff --git a/scripts/utils.sh b/scripts/utils.sh index 7cd817a..3047312 100644 --- a/scripts/utils.sh +++ b/scripts/utils.sh @@ -97,13 +97,13 @@ function pac_update(){ } function pac_install(){ - yes | sudo pacman -S --needed $@ + sudo pacman -S --needed --noconfirm $@ return 0 } function yay_install(){ - yes | yay -S --needed $@ --mflags "--nocheck" + yay -S --needed --noconfirm $@ --mflags "--nocheck" return 0 }