feat: migrate from woodpecker to forgejo actions
All checks were successful
/ build_debian (push) Successful in 2m0s
/ compile (push) Successful in 1m11s
/ golangci-lint (push) Successful in 2m3s

This commit is contained in:
s3lph 2023-12-19 05:59:57 +01:00
parent e6c1b41e20
commit 54c3cb51a4
Signed by: s3lph
GPG key ID: 0AA29A52FB33CFB5
4 changed files with 78 additions and 66 deletions

View file

@ -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 <s3lph@kabelsalat.ch> ${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"

View file

@ -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

View file

@ -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 <s3lph@kabelsalat.ch> $${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}

View file

@ -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