Merge branch 'auto-packaging' into dev-josh

This commit is contained in:
joshuaboud 2021-06-30 11:49:38 -03:00
commit 3dd7f17a6e
No known key found for this signature in database
GPG Key ID: 17EFB59E2A8BF50E
20 changed files with 147 additions and 287 deletions

40
.github/workflows/build-packages.yml vendored Normal file
View File

@ -0,0 +1,40 @@
name: Build Packages
on:
push:
branches:
- build-package
tags:
- 'v*.*.*'
jobs:
main:
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Package Binaries
run: build-packages ${{github.repository}} ${{github.workspace}}
- name: Set Variables
if: startsWith(github.ref, 'refs/tags/')
run: |
echo "PRERELEASE=$(cat ${{github.workspace}}/manifest.json | jq --raw-output '.prerelease')" >> $GITHUB_ENV
echo "TITLE=$(cat ${{github.workspace}}/manifest.json | jq --raw-output '.title')" >> $GITHUB_ENV
echo "VERSION=$(cat ${{github.workspace}}/manifest.json | jq --raw-output '.version')" >> $GITHUB_ENV
echo "REVISION=$(cat ${{github.workspace}}/manifest.json | jq --raw-output '.buildVersion')" >> $GITHUB_ENV
- name: GitHub Release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
name: ${{env.TITLE}} ${{env.VERSION}}
prerelease: ${{env.PRERELEASE}}
body_path: ${{github.workspace}}/CHANGELOG.md
files: |
${{github.workspace}}/dist/packages/*/*.deb
${{github.workspace}}/dist/packages/*/*.rpm
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Update Repository
if: startsWith(github.ref, 'refs/tags/')
run: update-repositories ${{github.workspace}}
- name: Publish Repository
if: startsWith(github.ref, 'refs/tags/')
run: publish-repo

12
.gitignore vendored
View File

@ -2,12 +2,12 @@
.vscode
# deb packaging
debian/cockpit-navigator
debian/cockpit-navigator.substvars
debian/cockpit-navigator.postrm.debhelper
debian/debhelper-build-stamp
debian/files
debian/.debhelper
packaging/focal/cockpit-navigator
packaging/focal/cockpit-navigator.substvars
packaging/focal/cockpit-navigator.postrm.debhelper
packaging/focal/debhelper-build-stamp
packaging/focal/files
packaging/focal/.debhelper
# build output
dist

3
CHANGELOG.md Normal file
View File

@ -0,0 +1,3 @@
## Cockpit Navigator 0.4.6-2
* First build with auto packaging

13
debian/control vendored
View File

@ -1,13 +0,0 @@
Source: cockpit-navigator
Section: utils
Priority: optional
Maintainer: Josh Boudreau <jboudreau@45drives.com>
Build-Depends: debhelper-compat (= 12)
Standards-Version: 4.4.1
Homepage: https://github.com/45Drives/cockpit-navigator
Package: cockpit-navigator
Architecture: all
Depends: ${shlibs:Depends}, ${misc:Depends},
cockpit, python3, rsync, zip
Description: A File System Browser for Cockpit.

View File

@ -1,17 +0,0 @@
FROM centos:7
LABEL description="Container in which to build el7 applications"
ENV TZ=America/Glace_Bay
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN yum install -y gcc rpm-build rpm-devel rpmlint make python python3 bash coreutils diffutils patch rpmdevtools
RUN mkdir -p /home/rpm/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS,tmp}
RUN echo %_topdir /home/rpm/rpmbuild > /etc/rpm/macros
RUN echo %_tmppath %{_topdir}/tmp >> /etc/rpm/macros
RUN chmod -R 777 /home/rpm
RUN ln -fs /usr/bin/python3 /usr/bin/python

View File

@ -1,15 +0,0 @@
FROM centos:8
LABEL description="Container in which to build el8 applications"
ENV TZ=America/Glace_Bay
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN dnf install -y gcc rpm-build rpm-devel rpmlint make python3 bash diffutils patch rpmdevtools
RUN mkdir -p /home/rpm/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS,tmp}
RUN echo %_topdir /home/rpm/rpmbuild > /etc/rpm/macros
RUN echo %_tmppath %{_topdir}/tmp >> /etc/rpm/macros
RUN chmod -R 777 /home/rpm

View File

@ -1,8 +0,0 @@
FROM ubuntu:focal
LABEL description="Container in which to build ubuntu applications"
ENV TZ=America/Glace_Bay
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt update && apt install -y make build-essential fakeroot devscripts debhelper python3

View File

@ -21,7 +21,7 @@ all: default
install:
mkdir -p $(DESTDIR)/usr/share/cockpit/
cp -rpf navigator $(DESTDIR)/usr/share/cockpit
ifeq ($(EL7),1)
ifeq ($(DIST),"el7")
sed -i "s/pf-c-button/btn/g;s/pf-m-primary/btn-primary/g;s/pf-m-secondary/btn-default/g;s/pf-m-danger/btn-danger/g" $(DESTDIR)/usr/share/cockpit/navigator/navigator.html
endif

59
manifest.json Normal file
View File

@ -0,0 +1,59 @@
{
"__version": "45D-R1",
"name": "cockpit-navigator",
"title": "Cockpit Navigator",
"prerelease": false,
"version": "0.4.6",
"buildVersion": "2",
"author": "Josh Boudreau <jboudreau@45drives.com>",
"url": "https://github.com/45Drives/cockpit-navigator",
"category": "utils",
"priority": "optional",
"licence": "GPL-3.0+",
"architecture": {
"deb": "all",
"el": "noarch"
},
"description": {
"long": "A File System Browser for Cockpit.",
"short": "A File System Browser for Cockpit."
},
"defaults": {
"urgency": "medium"
},
"dependencies": {
"deb": [
"cockpit",
"python3",
"rsync",
"zip"
],
"el": [
"cockpit",
"python3",
"rsync",
"zip"
]
},
"releases": [
{
"image": "ubuntu-focal-builder",
"codeName": "focal",
"type": "deb"
},
{
"image": "rocky-el8-builder",
"codeName": "el8",
"type": "el"
}
],
"changelog": {
"urgency": "medium",
"version": "0.4.6",
"buildVersion": "2",
"ignore": [],
"date": null,
"packager": "Josh Boudreau <jboudreau@45drives.com>",
"changes": []
}
}

View File

@ -1,20 +0,0 @@
#!/usr/bin/env bash
# Copyright (C) 2021 Joshua Boudreau <jboudreau@45drives.com>
#
# This file is part of Cockpit Navigator.
#
# Cockpit Navigator is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Cockpit Navigator is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Cockpit Navigator. If not, see <https://www.gnu.org/licenses/>.
./package-deb.sh && ./package-el7.sh && ./package-el8.sh

View File

@ -1,58 +0,0 @@
#!/usr/bin/env bash
# Copyright (C) 2021 Joshua Boudreau <jboudreau@45drives.com>
#
# This file is part of Cockpit Navigator.
#
# Cockpit Navigator is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Cockpit Navigator is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Cockpit Navigator. If not, see <https://www.gnu.org/licenses/>.
if [[ "$#" == 1 && "$1" == "clean" ]]; then
pushd debian
rm -f cockpit-navigator.postrm.debhelper cockpit-navigator.substvars debhelper-build-stamp files
rm -rf .debhelper cockpit-navigator
popd
rm -rf dist/ubuntu
exit 0
fi
command -v docker > /dev/null 2>&1 || {
echo "Please install docker.";
exit 1;
}
# if docker image DNE, build it
if [[ "$(docker images -q cockpit-navigator-ubuntu-builder 2> /dev/null)" == "" ]]; then
docker build -t cockpit-navigator-ubuntu-builder - < docker/ubuntu
res=$?
if [ $res -ne 0 ]; then
echo "Building docker image failed."
exit $res
fi
fi
mkdir -p dist/ubuntu
# mirror current directory to working directory in container, and mirror dist/ubuntu to .. for deb output
docker run -u $(id -u):$(id -g) -w /home/deb/build -it -v$(pwd):/home/deb/build -v$(pwd)/dist/ubuntu:/home/deb --rm cockpit-navigator-ubuntu-builder dpkg-buildpackage -us -uc -b
res=$?
if [ $res -ne 0 ]; then
echo "Packaging failed."
exit $res
fi
rmdir dist/ubuntu/build
echo "deb is in dist/ubuntu/"
exit 0

View File

@ -1,65 +0,0 @@
#!/usr/bin/env bash
# Copyright (C) 2021 Joshua Boudreau <jboudreau@45drives.com>
#
# This file is part of Cockpit Navigator.
#
# Cockpit Navigator is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Cockpit Navigator is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Cockpit Navigator. If not, see <https://www.gnu.org/licenses/>.
if [[ "$#" == 1 && "$1" == "clean" ]]; then
rm -rf dist/tmp
rm -rf dist/el7
exit 0
fi
command -v docker > /dev/null 2>&1 || {
echo "Please install docker.";
exit 1;
}
# if docker image DNE, build it
if [[ "$(docker images -q cockpit-navigator-el7-builder 2> /dev/null)" == "" ]]; then
docker build -t cockpit-navigator-el7-builder - < docker/el7
res=$?
if [ $res -ne 0 ]; then
echo "Building docker image failed."
exit $res
fi
fi
mkdir -p dist/{el7,tmp}
SOURCE_DIR_NAME=cockpit-navigator-$(grep Version el/cockpit-navigator.spec --color=never | awk '{print $2}')
SOURCE_DIR=dist/tmp/$SOURCE_DIR_NAME
mkdir -p $SOURCE_DIR
make DESTDIR=$SOURCE_DIR EL7=1 install
pushd $SOURCE_DIR/..
tar -czvf $SOURCE_DIR_NAME.tar.gz $SOURCE_DIR_NAME
popd
# build rpm from source tar and place it dist/el7 by mirroring dist/el7 to rpmbuild/RPMS
docker run -u $(id -u):$(id -g) -w /home/rpm/rpmbuild -it -v$(pwd)/dist/tmp:/home/rpm/rpmbuild/SOURCES -v$(pwd)/dist/el7:/home/rpm/rpmbuild/RPMS -v$(pwd)/el:/home/rpm/rpmbuild/SPECS --rm cockpit-navigator-el7-builder rpmbuild -ba SPECS/cockpit-navigator.spec
res=$?
if [ $res -ne 0 ]; then
echo "Packaging failed."
exit $res
fi
rm -rf dist/tmp
echo "rpm is in dist/el7/"
exit 0

View File

@ -1,65 +0,0 @@
#!/usr/bin/env bash
# Copyright (C) 2021 Joshua Boudreau <jboudreau@45drives.com>
#
# This file is part of Cockpit Navigator.
#
# Cockpit Navigator is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Cockpit Navigator is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Cockpit Navigator. If not, see <https://www.gnu.org/licenses/>.
if [[ "$#" == 1 && "$1" == "clean" ]]; then
rm -rf dist/tmp
rm -rf dist/el8
exit 0
fi
command -v docker > /dev/null 2>&1 || {
echo "Please install docker.";
exit 1;
}
# if docker image DNE, build it
if [[ "$(docker images -q cockpit-navigator-el8-builder 2> /dev/null)" == "" ]]; then
docker build -t cockpit-navigator-el8-builder - < docker/el8
res=$?
if [ $res -ne 0 ]; then
echo "Building docker image failed."
exit $res
fi
fi
mkdir -p dist/{el8,tmp}
SOURCE_DIR_NAME=cockpit-navigator-$(grep Version el/cockpit-navigator.spec --color=never | awk '{print $2}')
SOURCE_DIR=dist/tmp/$SOURCE_DIR_NAME
mkdir -p $SOURCE_DIR
make DESTDIR=$SOURCE_DIR install
pushd $SOURCE_DIR/..
tar -czvf $SOURCE_DIR_NAME.tar.gz $SOURCE_DIR_NAME
popd
# build rpm from source tar and place it dist/el8 by mirroring dist/el8 to rpmbuild/RPMS
docker run -u $(id -u):$(id -g) -w /home/rpm/rpmbuild -it -v$(pwd)/dist/tmp:/home/rpm/rpmbuild/SOURCES -v$(pwd)/dist/el8:/home/rpm/rpmbuild/RPMS -v$(pwd)/el:/home/rpm/rpmbuild/SPECS --rm cockpit-navigator-el8-builder rpmbuild -ba SPECS/cockpit-navigator.spec
res=$?
if [ $res -ne 0 ]; then
echo "Packaging failed."
exit $res
fi
rm -rf dist/tmp
echo "rpm is in dist/el8/"
exit 0

1
packaging/el7 Symbolic link
View File

@ -0,0 +1 @@
el8

View File

@ -1,18 +1,18 @@
Name: cockpit-navigator
Version: 0.4.6
Release: 1%{?dist}
Summary: A File System Browser for Cockpit.
License: GPL-3.0+
URL: github.com/45drives/cockpit-navigator/blob/main/README.md
Source0: %{name}-%{version}.tar.gz
BuildArch: noarch
Requires: cockpit python3 rsync zip
Name: ::package_name::
Version: ::package_version::
Release: ::package_build_version::%{?dist}
Summary: ::package_description_short::
License: ::package_licence::
URL: ::package_url::
Source0: %{name}-%{version}.tar.gz
BuildArch: ::package_architecture_el::
Requires: ::package_dependencies_el::
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
%description
Cockpit Navigator
A File System Browser for Cockpit.
::package_title::
::package_description_long::
%prep
%setup -q
@ -21,9 +21,7 @@ A File System Browser for Cockpit.
# empty
%install
rm -rf %{buildroot}
mkdir -p %{buildroot}
cp -a * %{buildroot}
make DESTDIR=%{buildroot} DIST=%{dist} install
%clean
rm -rf %{buildroot}
@ -32,6 +30,8 @@ rm -rf %{buildroot}
/usr/share/cockpit/navigator/*
%changelog
* Wed Jun 30 2021 Josh Boudreau <jboudreau@45drives.com> 0.4.6-2
- First build with auto packaging
* Fri Jun 18 2021 Josh Boudreau <jboudreau@45drives.com> 0.4.6-1
- Disable navigation buttons when invalid.
* Thu Jun 17 2021 Josh Boudreau <jboudreau@45drives.com> 0.4.5-1
@ -77,4 +77,4 @@ rm -rf %{buildroot}
entries.
- Add custom right click menu.
* Fri May 28 2021 Josh Boudreau <jboudreau@45drives.com> 0.1.0-1
- First Build
- First Build

View File

@ -1,3 +1,9 @@
cockpit-navigator (0.4.6-2focal) focal; urgency=medium
* First build with auto packaging
-- Josh Boudreau <jboudreau@45drives.com> Wed, 30 Jun 2021 08:39:44 -0300
cockpit-navigator (0.4.6-1focal) focal; urgency=low
* Disable navigation buttons when invalid.
@ -94,4 +100,4 @@ cockpit-navigator (0.1.0-1focal) focal; urgency=medium
* Initial packaging of cockpit-navigator for Ubuntu Focal.
-- Josh Boudreau <jboudreau@45drives.com> Fri, 28 May 2021 15:58:00 -0300
-- Josh Boudreau <jboudreau@45drives.com> Fri, 28 May 2021 15:58:00 -0300

12
packaging/focal/control Normal file
View File

@ -0,0 +1,12 @@
Source: ::package_name::
Section: ::package_category::
Priority: ::package_priority::
Maintainer: ::package_author::
Build-Depends: debhelper-compat (= 12)
Standards-Version: 4.4.1
Homepage: ::package_url::
Package: ::package_name::
Architecture: ::package_architecture_deb::
Depends: ::package_dependencies_deb::
Description: ::package_description_short::

View File

@ -1,7 +1,7 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: cockpit-navigator
Upstream-Contact: Josh Boudreau <jboudreau@45drives.com>
Source: https://github.com/45Drives/cockpit-navigator
Upstream-Name: ::package_name::
Upstream-Contact: ::package_author::
Source: ::package_url::
Files: *
Copyright: 2021 Josh Boudreau <jboudreau@45drives.com>