feat: woodpecker ci
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
nyyu 2022-11-16 22:07:36 +01:00
parent bec1cf5014
commit 7b3e031bc2
3 changed files with 12 additions and 30 deletions

View File

@ -14,7 +14,7 @@ update_pkg() {
makepkg --printsrcinfo >.SRCINFO
git add .SRCINFO PKGBUILD
if git commit -m "$(basename $(pwd)): update to ${ver} [CI SKIP]"; then
git push --set-upstream origin "${DRONE_BRANCH}"
git push --set-upstream origin "${CI_COMMIT_BRANCH}"
fi
fi
fi

View File

@ -1,14 +1,9 @@
kind: pipeline
type: docker
name: default
steps:
- name: build
pull: always
pipeline:
build:
image: archlinux:base-devel
pull: true
volumes:
- name: repo
path: /repo
- /mnt/archlinux/nyyu:/repo
commands:
- cp -f conf/{makepkg,pacman}.conf /etc/
- cat conf/pacman-conf.d-noextract.conf >> /etc/pacman.conf
@ -20,21 +15,8 @@ steps:
- "echo 'build ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers"
- chown -R 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=DRONE_GIT_HTTP_URL,DRONE_BRANCH,GIT_PASSWORD sh -c './build.sh'
environment:
PGP_KEY:
from_secret: PGP_KEY
PGP_PWD:
from_secret: PGP_PWD
PGP_ID:
from_secret: PGP_ID
GIT_PASSWORD:
from_secret: git_password
volumes:
- name: repo
host:
path: /mnt/archlinux/nyyu
trigger:
- sudo -u build --preserve-env=CI_REPO_REMOTE,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

@ -34,7 +34,7 @@ build() {
git config --global user.email "drone@nyyu.dev"
git config --global user.name "drone"
git remote set-url origin "${DRONE_GIT_HTTP_URL}"
git remote set-url origin "${CI_REPO_REMOTE}"
# shellcheck disable=SC2016
git config credential.helper '!f() { sleep 1; echo "username=drone"; echo "password=${GIT_PASSWORD}"; }; f'
@ -65,7 +65,7 @@ while read -r p; do
cd ..
done <aur.txt
del=$(git --no-pager diff HEAD~${DRONE_COMMIT_BEFORE} aur.txt | tail -n +4 | grep -E '^-' | cut -c2-)
del=$(git --no-pager diff HEAD~${CI_PREV_COMMIT_SHA} aur.txt | tail -n +4 | grep -E '^-' | cut -c2-)
if [ -n "${del}" ]; then
# shellcheck disable=SC2086
repo-remove -s /repo/nyyu.db.tar.zst ${del}