feat: woodpecker ci
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
bec1cf5014
commit
7b3e031bc2
2
.util.sh
2
.util.sh
@ -14,7 +14,7 @@ update_pkg() {
|
|||||||
makepkg --printsrcinfo >.SRCINFO
|
makepkg --printsrcinfo >.SRCINFO
|
||||||
git add .SRCINFO PKGBUILD
|
git add .SRCINFO PKGBUILD
|
||||||
if git commit -m "$(basename $(pwd)): update to ${ver} [CI SKIP]"; then
|
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
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -1,14 +1,9 @@
|
|||||||
kind: pipeline
|
pipeline:
|
||||||
type: docker
|
build:
|
||||||
name: default
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: build
|
|
||||||
pull: always
|
|
||||||
image: archlinux:base-devel
|
image: archlinux:base-devel
|
||||||
|
pull: true
|
||||||
volumes:
|
volumes:
|
||||||
- name: repo
|
- /mnt/archlinux/nyyu:/repo
|
||||||
path: /repo
|
|
||||||
commands:
|
commands:
|
||||||
- cp -f conf/{makepkg,pacman}.conf /etc/
|
- cp -f conf/{makepkg,pacman}.conf /etc/
|
||||||
- cat conf/pacman-conf.d-noextract.conf >> /etc/pacman.conf
|
- cat conf/pacman-conf.d-noextract.conf >> /etc/pacman.conf
|
||||||
@ -20,21 +15,8 @@ steps:
|
|||||||
- "echo 'build ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers"
|
- "echo 'build ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers"
|
||||||
- chown -R build:build .
|
- 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=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'
|
- sudo -u build --preserve-env=CI_REPO_REMOTE,CI_COMMIT_BRANCH,CI_PREV_COMMIT_SHA,GIT_PASSWORD sh -c './build.sh'
|
||||||
environment:
|
secrets: [pgp_id, pgp_key, pgp_pwd, git_password]
|
||||||
PGP_KEY:
|
when:
|
||||||
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:
|
|
||||||
branch:
|
branch:
|
||||||
- master
|
- master
|
4
build.sh
4
build.sh
@ -34,7 +34,7 @@ build() {
|
|||||||
|
|
||||||
git config --global user.email "drone@nyyu.dev"
|
git config --global user.email "drone@nyyu.dev"
|
||||||
git config --global user.name "drone"
|
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
|
# shellcheck disable=SC2016
|
||||||
git config credential.helper '!f() { sleep 1; echo "username=drone"; echo "password=${GIT_PASSWORD}"; }; f'
|
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 ..
|
cd ..
|
||||||
done <aur.txt
|
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
|
if [ -n "${del}" ]; then
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
repo-remove -s /repo/nyyu.db.tar.zst ${del}
|
repo-remove -s /repo/nyyu.db.tar.zst ${del}
|
||||||
|
Loading…
Reference in New Issue
Block a user