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'