From 51e59537a2a21186fe42a85862ff818fa672277b Mon Sep 17 00:00:00 2001 From: nyyu Date: Sat, 9 Dec 2023 14:19:53 +0100 Subject: [PATCH] fix: use build dir --- .woodpecker.yml | 5 +++-- build.sh | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index d5dae1c..4d1cfc9 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -11,9 +11,10 @@ steps: - pacman -Syu git jq pacman-contrib pandoc-bin unzip --noconfirm - useradd build -m - "echo 'build ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers" - - chown -R build:build . + - mkdir /build + - chown -R build:build . /build - sudo -u build --preserve-env=PGP_KEY,PGP_PWD,PGP_ID sh -c 'mkdir ~/.gnupg && echo -e "default-cache-ttl 3600\nallow-preset-passphrase" > ~/.gnupg/gpg-agent.conf && echo "$PGP_KEY" | gpg --import --no-tty --batch --yes && echo "$PGP_PWD" | /usr/lib/gnupg/gpg-preset-passphrase --preset $PGP_ID' - - sudo -u build --preserve-env=CI_REPO_REMOTE,CI_COMMIT_BRANCH,CI_PREV_COMMIT_SHA,GIT_PASSWORD sh -c './build.sh' + - sudo -u build --preserve-env=CI_REPO_CLONE_URL,CI_COMMIT_BRANCH,CI_PREV_COMMIT_SHA,GIT_PASSWORD sh -c './build.sh' secrets: [pgp_id, pgp_key, pgp_pwd, git_password] when: branch: master diff --git a/build.sh b/build.sh index bf43072..08e213c 100755 --- a/build.sh +++ b/build.sh @@ -2,10 +2,13 @@ # shellcheck disable=SC3044,SC3009,SC2312 . .util.sh +export BUILDDIR=/build build() { local upd=$1 + rm -rf /build/* + if grep -c 'git+' PKGBUILD >/dev/null && ! grep -c '#tag=' PKGBUILD >/dev/null; then makepkg --noprepare --nodeps --nobuild --skippgpcheck --noconfirm makepkg --printsrcinfo >.SRCINFO @@ -48,7 +51,7 @@ build() { git config --global user.email "drone@nyyu.dev" git config --global user.name "drone" -git remote set-url origin "${CI_REPO_REMOTE}" +git remote set-url origin "${CI_REPO_CLONE_URL}" # shellcheck disable=SC2016 git config credential.helper '!f() { sleep 1; echo "username=drone"; echo "password=${GIT_PASSWORD}"; }; f'