Update publish ppa workflow #36
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish to Launchpad PPA | |
on: | |
push: | |
branches: [ "main" ] | |
jobs: | |
deploy: | |
strategy: | |
fail-fast: false | |
matrix: | |
series: [ "focal", "bionic", "xenial", "trusty", "jammy", "mantic", "noble" ] | |
include: | |
- series: focal | |
sub: 1 | |
- series: bionic | |
sub: 2 | |
- series: xenial | |
sub: 3 | |
- series: trusty | |
sub: 4 | |
- series: jammy | |
sub: 5 | |
- series: mantic | |
sub: 6 | |
- series: noble | |
sub: 7 | |
name: "Series ${{ matrix.series }}" | |
runs-on: ubuntu-20.04 | |
environment: launchpad | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Debuild | |
run: sudo apt install -y devscripts debhelper | |
- name: Set build output dir | |
id: strings | |
shell: bash | |
run: | | |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" | |
echo "origin=0.0.13" >> "$GITHUB_OUTPUT" | |
echo "version=0.0.13.${{ matrix.sub }}" >> "$GITHUB_OUTPUT" | |
- name: Configure CMake | |
run: > | |
cmake -B ${{ steps.strings.outputs.build-output-dir }} -S ${{ github.workspace }} | |
-DCMAKE_CXX_COMPILER=clang++ | |
-DCMAKE_C_COMPILER=clang | |
-DCMAKE_BUILD_TYPE=Release | |
-DIPADDRESS_BUILD_TESTS=OFF | |
-DIPADDRESS_BUILD_DOC=OFF | |
-DIPADDRESS_BUILD_PACKAGES=ON | |
-DIPADDRESS_BUILD_DEB_PACKAGE=ON | |
-DIPADDRESS_BUILD_RPM_PACKAGE=OFF | |
- name: Pack | |
run: | | |
cmake --build ${{ steps.strings.outputs.build-output-dir }} --config Release | |
cpack --config ${{ steps.strings.outputs.build-output-dir }}/CPackConfig.cmake | |
- name: Add source code | |
run: | | |
mkdir -p ${{ steps.strings.outputs.build-output-dir }}/ppa | |
mkdir -p ${{ steps.strings.outputs.build-output-dir }}/ppa/ipaddress-${{ steps.strings.outputs.version }} | |
mkdir -p ${{ steps.strings.outputs.build-output-dir }}/ppa/ipaddress-${{ steps.strings.outputs.version }}/debian | |
mkdir -p ${{ steps.strings.outputs.build-output-dir }}/ppa/ipaddress-${{ steps.strings.outputs.version }}/debian/source | |
cp _CPack_Packages/Linux/DEB/ipaddress-${{ steps.strings.outputs.origin }}/data.tar.gz ${{ steps.strings.outputs.build-output-dir }}/ppa/ipaddress_${{ steps.strings.outputs.version }}.orig.tar.gz | |
cp -r _CPack_Packages/Linux/DEB/ipaddress-${{ steps.strings.outputs.origin }}/usr ${{ steps.strings.outputs.build-output-dir }}/ppa/ipaddress-${{ steps.strings.outputs.version }}/ | |
- name: Add debian package files | |
env: | |
PPA_BUILD: ${{ vars.PPA_BUILD }} | |
run: | | |
dyear=$(date '+%Y') | |
printf "#!/usr/bin/make -f\n\n%%:\n dh \$@\n" > ${{ steps.strings.outputs.build-output-dir }}/ppa/ipaddress-${{ steps.strings.outputs.version }}/debian/rules | |
printf "ipaddress (${{ steps.strings.outputs.version }}-${PPA_BUILD}~${{ matrix.series }}1) ${{ matrix.series }}; urgency=low\n\n * Release ${{ steps.strings.outputs.version }}\n\n -- Vladimir Shaleev <[email protected]> " > ${{ steps.strings.outputs.build-output-dir }}/ppa/ipaddress-${{ steps.strings.outputs.version }}/debian/changelog | |
date +"%a, %d %b %Y %H:%M:%S %z" >> ${{ steps.strings.outputs.build-output-dir }}/ppa/ipaddress-${{ steps.strings.outputs.version }}/debian/changelog | |
echo 10 > ${{ steps.strings.outputs.build-output-dir }}/ppa/ipaddress-${{ steps.strings.outputs.version }}/debian/compat | |
echo "3.0 (quilt)" > ${{ steps.strings.outputs.build-output-dir }}/ppa/ipaddress-${{ steps.strings.outputs.version }}/debian/source/format | |
printf "Source: ipaddress\nSection: devel\nPriority: optional\nMaintainer: Vladimir Shaleev <[email protected]>\nStandards-Version: 4.5.0\nBuild-Depends: debhelper (>= 9)\n\nPackage: libipaddress-dev\nDepends: \${misc:Depends}\nArchitecture: all\nHomepage: https://github.com/VladimirShaleev/ipaddress\nDescription: A library for working and manipulating IPv4/IPv6 addresses and networks\n\n" > ${{ steps.strings.outputs.build-output-dir }}/ppa/ipaddress-${{ steps.strings.outputs.version }}/debian/control | |
printf "usr/include/ipaddress/*.hpp\nusr/share/cmake/ipaddress/*.cmake\nusr/share/pkgconfig/ipaddress.pc\n" > ${{ steps.strings.outputs.build-output-dir }}/ppa/ipaddress-${{ steps.strings.outputs.version }}/debian/libipaddress-dev.install | |
printf "Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ | |
Upstream-Name: ipaddress | |
Upstream-Contact: Vladimir Shaleev <[email protected]> | |
Source: https://github.com/VladimirShaleev/ipaddress | |
Files: * | |
Copyright: %d Vladimir Shaleev <[email protected]> | |
License: MIT | |
MIT License | |
Copyright (c) %d Vladimir Shaleev | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the \"Software\"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: | |
The above copyright notice and this permission notice shall be included in all | |
copies or substantial portions of the Software. | |
THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |
SOFTWARE. | |
" $dyear $dyear > ${{ steps.strings.outputs.build-output-dir }}/ppa/ipaddress-${{ steps.strings.outputs.version }}/debian/copyright | |
- name: Debuild, Sign and Publish | |
env: | |
PPA_BUILD: ${{ vars.PPA_BUILD }} | |
PUBLIC_KEY: ${{ vars.PUBLIC_KEY }} | |
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} | |
run: | | |
cd ${{ steps.strings.outputs.build-output-dir }}/ppa/ipaddress-${{ steps.strings.outputs.version }} | |
EDITOR=/bin/true dpkg-source -q --commit . changes | |
debuild -S -sa -us -uc | |
cd ${{ steps.strings.outputs.build-output-dir }}/ppa | |
export GPG_TTY=$(tty) | |
echo -n "$PRIVATE_KEY" | base64 --decode | gpg --batch --import | |
debsign -p'gpg --passphrase ${{ secrets.LAUNCHPAD_PASSWORD }} --batch --pinentry-mode loopback' -S -k$PUBLIC_KEY ipaddress_${{ steps.strings.outputs.version }}-${PPA_BUILD}~${{ matrix.series }}1_source.changes | |
dput ppa:vladimirshaleev/ipaddress ipaddress_${{ steps.strings.outputs.version }}-${PPA_BUILD}~${{ matrix.series }}1_source.changes |