Skip to content

Commit

Permalink
Add release action
Browse files Browse the repository at this point in the history
Auto-build .deb package
  • Loading branch information
timkimber committed Nov 11, 2022
1 parent 2e05de8 commit e508210
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 3 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/release-and-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Hacked together from https://github.com/qemu-riscv-xpack/.github/workflows/build-all.yml
# and https://github.com/palmetto/palm-cli/blob/develop/.github/workflows/pypi-deploy.yaml

name: getssl Deploy

on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
branches:
- main

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
path: "getssl"

- name: Get version number
id: get_version
run: |
echo ::set-output name=VERSION::$(bash ./getssl/getssl --version)
- name: Check version matches tag
run: |
if [ "${{ steps.get_version.outputs.VERSION }}" != "getssl V${GITHUB_REF#refs/tags/v}" ]; then
echo "Version number in getssl (${{ steps.get_version.outputs.VERSION }}) does not match tag (getssl V${GITHUB_REF#refs/tags/v})"
exit 1
fi
- name: build .deb package
id: build_deb
run: |
apt-get update
apt-get install -y build-essential devscripts debhelper pax liblocale-gettext-perl
wget https://github.com/debbuild/debbuild/releases/download/22.02.1/debbuild_22.02.1-0ubuntu20.04_all.deb
dpkg --install debbuild_22.02.1-0ubuntu20.04_all.deb
# Line 1959 has an extra ")" bracket
patch /usr/bin/debbuild < ./getssl/debbuild.patch
mkdir -p /root/debbuild/BUILD
mkdir -p /root/debbuild/DEBS/all
mkdir -p /root/debbuild/SDEBS
mkdir -p /root/debbuild/SOURCES
mkdir -p /root/debbuild/SPECS
tar -czf /root/debbuild/SOURCES/getssl-${GITHUB_REF#refs/tags/v}.tar.gz ./getssl/* --transform "s/getssl\//getssl-${GITHUB_REF#refs/tags/v}\//"
tar --append -f /root/getssl-${GITHUB_REF#refs/tags/v}.sdeb /root/debbuild/SOURCES/getssl-${GITHUB_REF#refs/tags/v}.tar.gz --transform 's,\.,SOURCES,'
tar --append -f /root/getssl-${GITHUB_REF#refs/tags/v}.sdeb -C ./getssl getssl.crontab getssl.logrotate --transform 's,^,SOURCES/,'
tar --append -f /root/getssl-${GITHUB_REF#refs/tags/v}.sdeb -C ./getssl getssl.spec --transform 's,^,SPECS/,'
debbuild --install /root/getssl-${GITHUB_REF#refs/tags/v}.sdeb
debbuild -vv -ba /root/debbuild/SPECS/getssl.spec
- name: create_release
id: create_release
if: steps.deploy.build_deb
uses: ncipollo/release-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag: ${{ github.ref }}
name: Draft Release ${{ github.ref }}
generateReleaseNotes: true
draft: true
prerelease: false
artifacts: /root/debbuild/DEBS/all/getssl_${GITHUB_REF#refs/tags/v}-*_all.deb
11 changes: 11 additions & 0 deletions debbuild.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- /usr/bin/debbuild 2022-11-11 15:34:22.529876000 +0000
+++ /usr/bin/debbuild.fix 2022-11-11 15:34:53.137410000 +0000
@@ -1956,7 +1956,7 @@
my $srcpkg = shift;
die _('Can\'t install ').$srcpkg."\n" unless $srcpkg =~ /\.sdeb$/;
$srcpkg = abs_path($srcpkg);
- system(expandmacros("cd %{_topdir}; %{__pax} -r -f $srcpkg)")) == 0 and
+ system(expandmacros("cd %{_topdir}; %{__pax} -r -f $srcpkg")) == 0 and
$finalmessages .= _('Extracted source package ').$srcpkg.
_(" to %{_topdir}.\n");
} # end install_sdeb()
7 changes: 4 additions & 3 deletions getssl.spec
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
%define _build_id_links none
%define debug_package %{nil}

# set this to true or the rpmbuild will fail with errors due to shebang defines
# set this to true or the rpmbuild will fail with errors due to shebang defines
# in some of the dns scripts for python
%global __brp_mangle_shebangs /usr/bin/true

Summary: getssl ACME Scripts for managing Let's Encrypt certificates
License: GPL
Packager: getssl developers <https://github.com/srvrco/getssl>
Name: getssl
Version: 2.47
Release: 1
Release: 2

URL: http://github.com/srvrco/getssl/
Source0: %{name}-%{version}.tar.gz
Expand All @@ -20,7 +21,7 @@ BuildArch: noarch
Requires: bash cronie
BuildRequires: bash

%description
%description
The %{name} package contains the getssl scripts, crontab files, and logrotate files for implementing automated creation and installation of SSL certificates from the Let's Encrypt ACME website.

%prep
Expand Down

0 comments on commit e508210

Please sign in to comment.