94 lines
2.7 KiB
YAML
94 lines
2.7 KiB
YAML
---
|
|
name: Build and publish Debian package
|
|
on: [create]
|
|
jobs:
|
|
build:
|
|
runs-on: docker
|
|
container:
|
|
image: docker.io/brenard/debian-python-deb:latest
|
|
steps:
|
|
- name: Check out repository code
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Build Debian package
|
|
env:
|
|
MAINTAINER_NAME: ${{ vars.MAINTAINER_NAME }}
|
|
MAINTAINER_EMAIL: ${{ vars.MAINTAINER_EMAIL }}
|
|
DEBIAN_CODENAME: ${{ vars.DEBIAN_CODENAME }}
|
|
run: |
|
|
echo "${{ secrets.GPG_KEY }}"|base64 -d|gpg --import
|
|
./build.sh
|
|
- name: Upload Debian package files
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: dist
|
|
path: |
|
|
dist/*.buildinfo
|
|
dist/*.changes
|
|
dist/*.deb
|
|
dist/*.dsc
|
|
dist/*.tar.gz
|
|
dist/release_notes.md
|
|
check_esphome_devices
|
|
|
|
publish-forgejo:
|
|
runs-on: docker
|
|
container:
|
|
image: docker.io/brenard/debian-python-deb:latest
|
|
if: ${{ needs.build.result == 'success' }}
|
|
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 dist/*.deb release/
|
|
mv check_esphome_devices release/
|
|
cd release/
|
|
md5sum * > md5sum.txt
|
|
sha512sum * > sha512sum.txt
|
|
{
|
|
echo 'release_note<<EOF'
|
|
cat release_notes.md
|
|
echo 'EOF'
|
|
} >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Publish release on Forgejo
|
|
uses: actions/forgejo-release@v1
|
|
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
|
|
if: |
|
|
${{
|
|
needs.build.result == 'success'
|
|
&& needs.publish-forgejo.result == 'success'
|
|
}}
|
|
steps:
|
|
- name: "Download Debian package files"
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: dist
|
|
|
|
- name: "Publish Debian package on Aptly repository"
|
|
uses: https://gitea.zionetrix.net/bn8/aptly-publish@master
|
|
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 }}
|