From 54c3cb51a4370b43d05f72fa9eeb525035ff7f88 Mon Sep 17 00:00:00 2001 From: s3lph Date: Tue, 19 Dec 2023 05:59:57 +0100 Subject: [PATCH] feat: migrate from woodpecker to forgejo actions --- .forgejo/workflows/package.yml | 46 ++++++++++++++++++++++++++++ .forgejo/workflows/test.yml | 29 ++++++++++++++++++ .woodpecker.yml | 56 ---------------------------------- README.md | 13 ++------ 4 files changed, 78 insertions(+), 66 deletions(-) create mode 100644 .forgejo/workflows/package.yml create mode 100644 .forgejo/workflows/test.yml delete mode 100644 .woodpecker.yml diff --git a/.forgejo/workflows/package.yml b/.forgejo/workflows/package.yml new file mode 100644 index 0000000..e3adc29 --- /dev/null +++ b/.forgejo/workflows/package.yml @@ -0,0 +1,46 @@ +--- + +on: + push: + tags: + - "v*" + +jobs: + + build_debian: + runs-on: docker + steps: + - uses: https://code.forgejo.org/actions/checkout@v4 + with: + fetch-depth: 0 + - name: Build package + run: | + apt update; apt install -y lintian sudo curl git make golang-go + make prometheus-dnssec-exporter + export EXPORTER_VERSION=$(git describe --tags --dirty | sed -re s/^v// | cut -d- -f1) + mkdir -p package/debian/prometheus-dnssec-exporter/usr/share/doc/prometheus-dnssec-exporter + (for ref in $(git tag --sort=-refname | grep -v v0.0.0); do + echo -e "prometheus-dnssec-exporter ($(echo "${ref}" | sed -re s/^v//)) stable; urgency=medium\n" + git log --format=' * %s' "$(git describe --tags --abbrev=0 ${ref}^)..${ref}" + DATE="$(git log --tags --simplify-by-decoration --pretty='format:%aD' "${ref}^..${ref}" | tail -1)" + echo -e "\n -- s3lph ${DATE}\n" + done) > package/debian/prometheus-dnssec-exporter/usr/share/doc/prometheus-dnssec-exporter/changelog + gzip -9n package/debian/prometheus-dnssec-exporter/usr/share/doc/prometheus-dnssec-exporter/changelog + mkdir -p package/debian/prometheus-dnssec-exporter/usr/bin + cp prometheus-dnssec-exporter package/debian/prometheus-dnssec-exporter/usr/bin + cd package/debian/prometheus-dnssec-exporter + find . -exec chown root:root {} \; + find . -type f -exec chmod 0644 {} \; + find . -type d -exec chmod 755 {} \; + chmod +x usr/bin/prometheus-dnssec-exporter DEBIAN/postinst DEBIAN/prerm + sed -re "s/__VERSION__/${EXPORTER_VERSION}-1/g" -i DEBIAN/control + cd .. + dpkg-deb --build prometheus-dnssec-exporter + mv "prometheus-dnssec-exporter.deb" "prometheus-dnssec-exporter_${EXPORTER_VERSION}-1_all.deb" + sudo -u nobody lintian "prometheus-dnssec-exporter_${EXPORTER_VERSION}-1_all.deb" || true + + - uses: https://git.kabelsalat.ch/s3lph/forgejo-action-debian-package-upload@v2 + with: + username: ${{ secrets.API_USERNAME }} + password: ${{ secrets.API_PASSWORD }} + deb: "package/debian/*.deb" diff --git a/.forgejo/workflows/test.yml b/.forgejo/workflows/test.yml new file mode 100644 index 0000000..630b362 --- /dev/null +++ b/.forgejo/workflows/test.yml @@ -0,0 +1,29 @@ +--- + +on: push + +jobs: + + compile: + runs-on: docker + steps: + - uses: https://code.forgejo.org/actions/checkout@v4 + with: + fetch-depth: 0 + - name: test + run: | + apt update; apt install --yes golang-go + go get -v + make prometheus-dnssec-exporter .changes + + golangci-lint: + runs-on: docker + steps: + - uses: https://code.forgejo.org/actions/checkout@v4 + with: + fetch-depth: 0 + - name: test + run: | + apt update; apt install --yes golang-go + go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.45.2 + ~/go/bin/golangci-lint run diff --git a/.woodpecker.yml b/.woodpecker.yml deleted file mode 100644 index a02809d..0000000 --- a/.woodpecker.yml +++ /dev/null @@ -1,56 +0,0 @@ ---- - -steps: - - compile: - image: golang:1.19 - group: test - commands: - - go get -v - - make prometheus-dnssec-exporter .changes - - golangci-lint: - image: golang:1.19 - group: test - commands: - - go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.45.2 - - golangci-lint run - - build_debian: - image: debian:bookworm - group: package - when: - - event: tag - secrets: - - GITEA_API_USERNAME - - GITEA_API_PASSWORD - - GITEA_API_REPOSITORY_DEB - commands: - - apt update; apt install -y lintian sudo curl git - - export EXPORTER_VERSION=$(git describe --tags --dirty | sed -re s/^v// | cut -d- -f1) - - mkdir -p package/debian/prometheus-dnssec-exporter/usr/share/doc/prometheus-dnssec-exporter - - | - (for ref in $(git tag --sort=-refname | grep -v v0.0.0); do - echo -e "prometheus-dnssec-exporter ($(echo "$${ref}" | sed -re s/^v//)) stable; urgency=medium\n" - git log --format=' * %s' "$(git describe --tags --abbrev=0 $${ref}^)..$${ref}" - DATE="$(git log --tags --simplify-by-decoration --pretty='format:%aD' "$${ref}^..$${ref}")" - echo -e "\n -- s3lph $${DATE}\n" - done) > package/debian/prometheus-dnssec-exporter/usr/share/doc/prometheus-dnssec-exporter/changelog - - gzip -9n package/debian/prometheus-dnssec-exporter/usr/share/doc/prometheus-dnssec-exporter/changelog - - mkdir -p package/debian/prometheus-dnssec-exporter/usr/bin - - cp prometheus-dnssec-exporter package/debian/prometheus-dnssec-exporter/usr/bin - - cd package/debian/prometheus-dnssec-exporter - - find . -exec chown root:root {} \; - - find . -type f -exec chmod 0644 {} \; - - find . -type d -exec chmod 755 {} \; - - chmod +x usr/bin/prometheus-dnssec-exporter DEBIAN/postinst DEBIAN/prerm - - sed -re "s/__VERSION__/$${EXPORTER_VERSION}-1/g" -i DEBIAN/control - - cd .. - - dpkg-deb --build prometheus-dnssec-exporter - - mv "prometheus-dnssec-exporter.deb" "prometheus-dnssec-exporter_$${EXPORTER_VERSION}-1_all.deb" - - sudo -u nobody lintian "prometheus-dnssec-exporter_$${EXPORTER_VERSION}-1_all.deb" || true - - >- - curl - --user "$${GITEA_API_USERNAME}:$${GITEA_API_PASSWORD}" - --upload-file "prometheus-dnssec-exporter_$${EXPORTER_VERSION}-1_all.deb" - $${GITEA_API_REPOSITORY_DEB} diff --git a/README.md b/README.md index 4ddfdce..6874897 100644 --- a/README.md +++ b/README.md @@ -16,18 +16,11 @@ make prometheus-dnssec-exporter ### Debian Package -There is an automatically built Debian package in my repository [https://repo.s3lph.me/]: +There is an automatically built Debian package in my repository. -```bash -wget -O /etc/apt/trusted.gpg.d/repo.s3lph.me.gpg https://repo.s3lph.me/debian/repo.s3lph.me.gpg -echo "deb https://repo.s3lph.me/debian stable main" > /etc/apt/sources.list.d/repo.s3lph.me.list -apt update -apt install prometheus-dnssec-exporter -``` +Follow the instructions at https://git.kabelsalat.ch/s3lph/-/packages/debian/prometheus-dnssec-exporter to add the repository and install the package. -If you do not want to add my repository to your system, you can also download the deb package from the repository: https://repo.s3lph.me/debian/pool/main/p/prometheus-dnssec-exporter/ - -Or you can build the package yourself: https://gitlab.com/s3lph/custom-packages/-/blob/main/prometheus-dnssec-exporter/build.sh +If you do not want to add my repository to your system, you can also download the deb package from the repository instead. ## Usage