103 lines
3.3 KiB
YAML
103 lines
3.3 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
|
|
mkdir dist
|
|
python3 -m pip wheel cx-Oracle -w dist
|
|
wheel2deb --map attrs=attr -x dist -o dist
|
|
cd dist/python3-cx-oracle_*_amd64
|
|
echo -n 10 > debian/compat
|
|
sed -i "s/wheel2deb <wheel2deb@upciti.com>/${MAINTAINER_NAME} <${MAINTAINER_EMAIL}>/" \
|
|
debian/changelog debian/control
|
|
sed -i "s/unstable/$DEBIAN_CODENAME/" debian/changelog
|
|
sed -i 's/^Depends: python3.*/Depends: python3/' debian/control
|
|
dpkg-buildpackage
|
|
cd ../../
|
|
rm -fr dist/python3-cx-oracle_*_amd64
|
|
curl --silent https://api.github.com/repos/oracle/python-cx_Oracle/releases | \
|
|
jq --raw-output ".[] | select(.tag_name == \"$GITHUB_REF_NAME\") | .body" \
|
|
> dist/release_notes.md
|
|
- 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/*.whl
|
|
dist/release_notes.md
|
|
|
|
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 *.whl release/
|
|
md5sum release/* > md5sum.txt
|
|
sha512sum release/* > sha512sum.txt
|
|
mv md5sum.txt sha512sum.txt release/
|
|
{
|
|
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
|
|
needs: build
|
|
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 }}
|