aptly-publish/.forgejo/workflows/release.yaml

92 lines
2.9 KiB
YAML
Raw Normal View History

---
name: Build and publish Debian package
on: [create]
jobs:
build:
runs-on: docker
container:
image: docker.io/brenard/nfpm:latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build Debian package
run: |
echo "${{ secrets.GPG_KEY }}" | base64 -d > key.gpg
2025-02-27 00:10:56 +01:00
export VERSION="$( git describe --tags | sed 's/^[^0-9]*//' )" || \
export VERSION="0.0-$( git log | grep -cE ^'commit ' )-$( git describe --tags --always )"
yq -y -i '.deb.signature.key_file = "key.gpg"' nfpm.yaml
yq -y -i '.maintainer = "${{ vars.MAINTAINER_NAME }} <${{ vars.MAINTAINER_EMAIL }}>"' nfpm.yaml
yq -y -i '.deb.distribution = "${{ vars.DEBIAN_CODENAME }}"' .chglog.yml
chglog init
mkdir dist
chglog format --template release -o dist/release_notes.md
nfpm -f nfpm.yaml package --packager deb --target dist
cp aptly-publish dist
- name: Upload Debian package files
uses: actions/upload-artifact@v3
with:
name: dist
path: |
dist
publish-forgejo:
runs-on: docker
container:
image: docker.io/brenard/debian-python-deb:latest
needs:
- build
steps:
- name: Download Debian package files
uses: actions/download-artifact@v3
with:
name: dist
- name: Create the release
id: create-release
shell: bash
run: |
mkdir release
mv *.deb release/
mv aptly-publish release/
md5sum release/* > md5sum.txt
sha512sum release/* > sha512sum.txt
mv md5sum.txt sha512sum.txt release/
{
echo 'release_note<<EOF'
cat release_notes.md | sed 's/"/\\"/g'
echo 'EOF'
} >> "$GITHUB_OUTPUT"
- name: Publish release on Forgejo
uses: actions/forgejo-release@v2
with:
direction: upload
url: https://gitea.zionetrix.net
token: ${{ secrets.forgejo_token }}
release-dir: release
release-notes: ${{ steps.create-release.outputs.release_note }}
publish-aptly:
runs-on: docker
container:
image: docker.io/brenard/aptly-publish:latest
needs:
- build
steps:
- name: "Download Debian package files"
uses: actions/download-artifact@v3
with:
name: dist
- name: "Publish Debian package on Aptly repository"
2025-02-26 15:34:41 +01:00
uses: https://gitea.zionetrix.net/bn8/aptly-publish@2025.2.2
with:
api_url: ${{ vars.apt_api_url }}
api_username: ${{ vars.apt_api_username }}
api_password: ${{ secrets.apt_api_password }}
repo_name: ${{ vars.apt_repo_name }}
path: "./"
source_name: ${{ vars.apt_source_name }}