fix: use build dir

This commit is contained in:
nyyu 2023-12-09 14:19:53 +01:00
parent baef4b9a93
commit 51e59537a2
2 changed files with 7 additions and 3 deletions

View File

@ -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

View File

@ -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'