diff --git a/.github/workflows/build-packages.yml b/.github/workflows/build-packages.yml new file mode 100644 index 0000000..70b71f0 --- /dev/null +++ b/.github/workflows/build-packages.yml @@ -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 \ No newline at end of file diff --git a/.gitignore b/.gitignore index 97f2204..a9db4a3 100644 --- a/.gitignore +++ b/.gitignore @@ -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 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..06083a7 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,3 @@ +## Cockpit Navigator 0.4.6-2 + +* First build with auto packaging \ No newline at end of file diff --git a/debian/control b/debian/control deleted file mode 100644 index 6163d5d..0000000 --- a/debian/control +++ /dev/null @@ -1,13 +0,0 @@ -Source: cockpit-navigator -Section: utils -Priority: optional -Maintainer: Josh Boudreau -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. diff --git a/docker/el7 b/docker/el7 deleted file mode 100644 index 7076f22..0000000 --- a/docker/el7 +++ /dev/null @@ -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 diff --git a/docker/el8 b/docker/el8 deleted file mode 100644 index e62dab7..0000000 --- a/docker/el8 +++ /dev/null @@ -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 diff --git a/docker/ubuntu b/docker/ubuntu deleted file mode 100644 index 4c11f1c..0000000 --- a/docker/ubuntu +++ /dev/null @@ -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 diff --git a/makefile b/makefile index 50cefd4..5628621 100644 --- a/makefile +++ b/makefile @@ -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 diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..5c7a567 --- /dev/null +++ b/manifest.json @@ -0,0 +1,59 @@ +{ + "__version": "45D-R1", + "name": "cockpit-navigator", + "title": "Cockpit Navigator", + "prerelease": false, + "version": "0.4.6", + "buildVersion": "2", + "author": "Josh Boudreau ", + "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 ", + "changes": [] + } +} \ No newline at end of file diff --git a/package-all.sh b/package-all.sh deleted file mode 100755 index 16626b4..0000000 --- a/package-all.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash - -# Copyright (C) 2021 Joshua Boudreau -# -# 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 . - -./package-deb.sh && ./package-el7.sh && ./package-el8.sh diff --git a/package-deb.sh b/package-deb.sh deleted file mode 100755 index 82d3d00..0000000 --- a/package-deb.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env bash - -# Copyright (C) 2021 Joshua Boudreau -# -# 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 . - -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 diff --git a/package-el7.sh b/package-el7.sh deleted file mode 100755 index b8551b1..0000000 --- a/package-el7.sh +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env bash - -# Copyright (C) 2021 Joshua Boudreau -# -# 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 . - -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 diff --git a/package-el8.sh b/package-el8.sh deleted file mode 100755 index 01b912f..0000000 --- a/package-el8.sh +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env bash - -# Copyright (C) 2021 Joshua Boudreau -# -# 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 . - -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 diff --git a/packaging/el7 b/packaging/el7 new file mode 120000 index 0000000..4dad90d --- /dev/null +++ b/packaging/el7 @@ -0,0 +1 @@ +el8 \ No newline at end of file diff --git a/el/cockpit-navigator.spec b/packaging/el8/main.spec similarity index 84% rename from el/cockpit-navigator.spec rename to packaging/el8/main.spec index a9115db..3c6fbe2 100644 --- a/el/cockpit-navigator.spec +++ b/packaging/el8/main.spec @@ -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 0.4.6-2 +- First build with auto packaging * Fri Jun 18 2021 Josh Boudreau 0.4.6-1 - Disable navigation buttons when invalid. * Thu Jun 17 2021 Josh Boudreau 0.4.5-1 @@ -77,4 +77,4 @@ rm -rf %{buildroot} entries. - Add custom right click menu. * Fri May 28 2021 Josh Boudreau 0.1.0-1 -- First Build +- First Build \ No newline at end of file diff --git a/debian/changelog b/packaging/focal/changelog similarity index 95% rename from debian/changelog rename to packaging/focal/changelog index 5f734fe..1bc9bd1 100644 --- a/debian/changelog +++ b/packaging/focal/changelog @@ -1,3 +1,9 @@ +cockpit-navigator (0.4.6-2focal) focal; urgency=medium + + * First build with auto packaging + + -- Josh Boudreau 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 Fri, 28 May 2021 15:58:00 -0300 + -- Josh Boudreau Fri, 28 May 2021 15:58:00 -0300 \ No newline at end of file diff --git a/packaging/focal/control b/packaging/focal/control new file mode 100644 index 0000000..d9bdb6a --- /dev/null +++ b/packaging/focal/control @@ -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:: diff --git a/debian/copyright b/packaging/focal/copyright similarity index 88% rename from debian/copyright rename to packaging/focal/copyright index bf6b808..eb54cf1 100644 --- a/debian/copyright +++ b/packaging/focal/copyright @@ -1,7 +1,7 @@ Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ -Upstream-Name: cockpit-navigator -Upstream-Contact: Josh Boudreau -Source: https://github.com/45Drives/cockpit-navigator +Upstream-Name: ::package_name:: +Upstream-Contact: ::package_author:: +Source: ::package_url:: Files: * Copyright: 2021 Josh Boudreau diff --git a/debian/rules b/packaging/focal/rules similarity index 100% rename from debian/rules rename to packaging/focal/rules diff --git a/debian/source/format b/packaging/focal/source/format similarity index 100% rename from debian/source/format rename to packaging/focal/source/format