From 9f792d5841bb7196c303cf422bc09ab8c8eabbcf Mon Sep 17 00:00:00 2001 From: "T. von Dein" Date: Sun, 14 Dec 2025 21:15:42 +0100 Subject: [PATCH] move to codeberg (#1) --- .woodpecker/build.yaml | 22 ++++++++++++++++ .woodpecker/release.sh | 54 ++++++++++++++++++++++++++++++++++++++++ .woodpecker/release.yaml | 23 +++++++++++++++++ Makefile.PL | 2 +- 4 files changed, 100 insertions(+), 1 deletion(-) create mode 100644 .woodpecker/build.yaml create mode 100755 .woodpecker/release.sh create mode 100644 .woodpecker/release.yaml diff --git a/.woodpecker/build.yaml b/.woodpecker/build.yaml new file mode 100644 index 0000000..e381477 --- /dev/null +++ b/.woodpecker/build.yaml @@ -0,0 +1,22 @@ +matrix: + include: + - image: perl:5.36.0-slim-bullseye + - image: perl:5.38.0-slim-bookworm + - image: perl:5.40.0-slim-bookworm + - image: perl:5.42.0-slim-bookworm + - image: perl:5.43.5-slim-bookworm + +steps: + test: + when: + event: [push] + image: ${image} + commands: + - apt-get update -y + - apt-get install -y gcc + - cpanm -n DBM::Deep + - cpanm -n YAML + - cpanm -n Data::Interactive::Inspect + - perl Makefile.PL + - make + - make test diff --git a/.woodpecker/release.sh b/.woodpecker/release.sh new file mode 100755 index 0000000..a44513a --- /dev/null +++ b/.woodpecker/release.sh @@ -0,0 +1,54 @@ +#!/bin/bash + +# This is my own simple codeberg generic releaser. It takes to +# binaries to be uploaded as arguments and takes every other args from +# env. Works on tags or normal commits (push), tags must start with v. + + +set -e + +die() { + echo $* + exit 1 +} + +if test -z "$DEPLOY_TOKEN"; then + die "token DEPLOY_TOKEN not set" +fi + +git fetch --all + +# determine current tag or commit hash +version="$CI_COMMIT_TAG" +previous="" +log="" +if test -z "$version"; then + version="${CI_COMMIT_SHA:0:6}" + log=$(git log -1 --oneline) +else + previous=$(git tag -l | grep -E "^v" | tac | grep -A1 "$version" | tail -1) + log=$(git log -1 --oneline "${previous}..${version}" | sed 's|^|- |g') +fi + +# release body +printf "# Changes\n\n %s\n" "$log" > body.txt + +# create the release +https --ignore-stdin --check-status -b -A bearer -a "$DEPLOY_TOKEN" POST \ + "https://codeberg.org/api/v1/repos/${CI_REPO_OWNER}/${CI_REPO_NAME}/releases" \ + tag_name="$version" name="Release $version" body=@body.txt > release.json + +# we need the id to upload files +ID=$(jq -r .id < release.json) + +if test -z "$ID"; then + cat release.json + die "failed to create release" +fi + +# actually upload +for file in "$@"; do + https --ignore-stdin --check-status -A bearer -a "$DEPLOY_TOKEN" -f POST \ + "https://codeberg.org/api/v1/repos/${CI_REPO_OWNER}/${CI_REPO_NAME}/releases/$ID/assets" \ + "name=${file}" "attachment@${file}" +done diff --git a/.woodpecker/release.yaml b/.woodpecker/release.yaml new file mode 100644 index 0000000..596150a --- /dev/null +++ b/.woodpecker/release.yaml @@ -0,0 +1,23 @@ +# build release + +steps: + compile: + when: + event: [tag] + image: perl:5.43.5-slim-bookworm + commands: + - perl Makefile.PL + - make + - make dist + + release: + image: alpine:latest + when: + event: [tag] + environment: + DEPLOY_TOKEN: + from_secret: DEPLOY_TOKEN + commands: + - apk update + - apk add --no-cache bash httpie jq git + - .woodpecker/release.sh ${CI_REPO_NAME}-$CI_COMMIT_TAG.tar.gz diff --git a/Makefile.PL b/Makefile.PL index 6017998..b9c8fa7 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -25,7 +25,7 @@ WriteMakefile( test => { TESTS => 't/*.t' }, 'META_MERGE' => { resources => { - repository => 'https://github.com/TLINDEN/dbmdeep', + repository => 'https://codeberg.org/scip/dbmdeep', }, },