diff --git a/.util.sh b/.util.sh index 6c7ce02..529822c 100644 --- a/.util.sh +++ b/.util.sh @@ -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 diff --git a/.drone.yml b/.woodpecker.yml similarity index 63% rename from .drone.yml rename to .woodpecker.yml index b02f528..f7ba0fa 100644 --- a/.drone.yml +++ b/.woodpecker.yml @@ -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: - branch: - - master + - 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 diff --git a/build.sh b/build.sh index 0620e1d..0cdbebe 100755 --- a/build.sh +++ b/build.sh @@ -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