From 8ba0663f9fe56846cbb140bdc24a217e6567bf60 Mon Sep 17 00:00:00 2001 From: Paul Hebble Date: Sun, 17 Jul 2022 14:31:12 -0500 Subject: [PATCH] Generate RPM repo for releases and under dev builds --- .github/workflows/deploy.yml | 35 +++++++++++++++++++++++++++++----- .github/workflows/release.yml | 36 ++++++++++++++++++++++++++++------- build.cake | 5 +++++ debian/copyright | 2 +- doc/rpm-repo.md | 23 ++++++++++++++++++++++ rpm/Makefile | 27 ++++++++++++++++++++++++-- rpm/ckan_nightly.repo | 6 ++++++ rpm/ckan_stable.repo | 6 ++++++ 8 files changed, 125 insertions(+), 15 deletions(-) create mode 100644 doc/rpm-repo.md create mode 100644 rpm/ckan_nightly.repo create mode 100644 rpm/ckan_stable.repo diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 804da84921..b442edb12e 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -30,7 +30,7 @@ jobs: fi - name: Installing build dependencies - run: apt-get update && apt-get install -y git make sed gzip fakeroot lintian dpkg-dev + run: apt-get update && apt-get install -y git make sed gzip fakeroot lintian dpkg-dev gpg createrepo-c - name: Installing runtime dependencies run: apt-get install -y xvfb - name: Install Docker @@ -67,14 +67,27 @@ jobs: CODENAME: nightly run: ./build deb --configuration=Release --exclusive if: ${{ steps.check_version.outputs.odd_build }} - - name: Sign deb release + - name: Build rpm + run: ./build rpm --configuration=Release --exclusive + if: ${{ steps.check_version.outputs.odd_build }} + - name: Import GPG key env: - CODENAME: nightly DEBIAN_PRIVATE_KEY: ${{ secrets.DEBIAN_PRIVATE_KEY }} run: | echo "$DEBIAN_PRIVATE_KEY" | base64 --decode | gpg --batch --import gpg --list-secret-keys --keyid-format LONG - ./build deb-sign --configuration=Release --exclusive + if: ${{ env.DEBIAN_PRIVATE_KEY && steps.check_version.outputs.odd_build }} + - name: Sign deb release + env: + CODENAME: nightly + DEBIAN_PRIVATE_KEY: ${{ secrets.DEBIAN_PRIVATE_KEY }} + run: ./build deb-sign --configuration=Release --exclusive + if: ${{ env.DEBIAN_PRIVATE_KEY && steps.check_version.outputs.odd_build }} + - name: Build rpm repository + env: + CODENAME: nightly + DEBIAN_PRIVATE_KEY: ${{ secrets.DEBIAN_PRIVATE_KEY }} + run: ./build rpm-repo --configuration=Release --exclusive if: ${{ env.DEBIAN_PRIVATE_KEY && steps.check_version.outputs.odd_build }} - name: Run tests @@ -126,7 +139,7 @@ jobs: SOURCE_DIR: _build/deb/apt-repo-root DEST_DIR: deb if: ${{ env.AWS_ACCESS_KEY_ID && env.AWS_SECRET_ACCESS_KEY && steps.check_version.outputs.odd_build }} - - name: Push Release file to S3 + - name: Push nightly APT repo to S3 uses: jakejarvis/s3-sync-action@master with: args: --follow-symlinks @@ -138,6 +151,18 @@ jobs: SOURCE_DIR: _build/deb/apt-repo-dist DEST_DIR: deb/dists/nightly if: ${{ env.AWS_ACCESS_KEY_ID && env.AWS_SECRET_ACCESS_KEY && steps.check_version.outputs.odd_build }} + - name: Push nightly RPM repo to S3 + uses: jakejarvis/s3-sync-action@master + with: + args: --follow-symlinks + env: + AWS_S3_BUCKET: ksp-ckan + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_REGION: us-east-1 + SOURCE_DIR: _build/rpm/repo + DEST_DIR: rpm/nightly + if: ${{ env.AWS_ACCESS_KEY_ID && env.AWS_SECRET_ACCESS_KEY && steps.check_version.outputs.odd_build }} - name: Send Discord Notification env: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b2367e8683..f6844dedb2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,7 +16,7 @@ jobs: - uses: actions/checkout@v3 - name: Installing build dependencies - run: apt-get update && apt-get install -y git make sed libplist-utils xorriso gzip fakeroot lintian rpm wget jq dpkg-dev + run: apt-get update && apt-get install -y git make sed libplist-utils xorriso gzip fakeroot lintian rpm wget jq dpkg-dev gpg createrepo-c - name: Installing runtime dependencies run: apt-get install -y xvfb @@ -31,17 +31,27 @@ jobs: env: CODENAME: stable run: ./build deb --configuration=Release --exclusive - - name: Sign deb release + - name: Build rpm + run: ./build rpm --configuration=Release --exclusive + - name: Import GPG key env: - CODENAME: stable DEBIAN_PRIVATE_KEY: ${{ secrets.DEBIAN_PRIVATE_KEY }} run: | echo "$DEBIAN_PRIVATE_KEY" | base64 --decode | gpg --batch --import gpg --list-secret-keys --keyid-format LONG - ./build deb-sign --configuration=Release --exclusive if: ${{ env.DEBIAN_PRIVATE_KEY }} - - name: Build rpm - run: ./build rpm --configuration=Release --exclusive + - name: Sign deb release + env: + CODENAME: stable + DEBIAN_PRIVATE_KEY: ${{ secrets.DEBIAN_PRIVATE_KEY }} + run: ./build deb-sign --configuration=Release --exclusive + if: ${{ env.DEBIAN_PRIVATE_KEY }} + - name: Build rpm repository + env: + CODENAME: stable + DEBIAN_PRIVATE_KEY: ${{ secrets.DEBIAN_PRIVATE_KEY }} + run: ./build rpm-repo --configuration=Release --exclusive + if: ${{ env.DEBIAN_PRIVATE_KEY }} - name: Get release data id: release_data @@ -67,7 +77,7 @@ jobs: SOURCE_DIR: _build/deb/apt-repo-root DEST_DIR: deb if: ${{ env.AWS_ACCESS_KEY_ID && env.AWS_SECRET_ACCESS_KEY }} - - name: Push Release file to S3 + - name: Push stable APT repo to S3 uses: jakejarvis/s3-sync-action@master with: args: --follow-symlinks @@ -79,6 +89,18 @@ jobs: SOURCE_DIR: _build/deb/apt-repo-dist DEST_DIR: deb/dists/stable if: ${{ env.AWS_ACCESS_KEY_ID && env.AWS_SECRET_ACCESS_KEY }} + - name: Push stable RPM repo to S3 + uses: jakejarvis/s3-sync-action@master + with: + args: --follow-symlinks + env: + AWS_S3_BUCKET: ksp-ckan + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_REGION: us-east-1 + SOURCE_DIR: _build/rpm/repo + DEST_DIR: rpm/stable + if: ${{ env.AWS_ACCESS_KEY_ID && env.AWS_SECRET_ACCESS_KEY }} - name: Upload ckan.exe uses: actions/upload-release-asset@v1.0.1 diff --git a/build.cake b/build.cake index de97138bf1..cdbc1421d6 100644 --- a/build.cake +++ b/build.cake @@ -158,6 +158,11 @@ Task("rpm") .IsDependentOn("Ckan") .Does(() => MakeIn("rpm")); +Task("rpm-repo") + .Description("Build the rpm repository for RPM-based distros.") + .IsDependentOn("Ckan") + .Does(() => MakeIn("rpm", "repo")); + Task("rpm-test") .Description("Test the rpm packaging.") .IsDependentOn("Ckan") diff --git a/debian/copyright b/debian/copyright index dd5066ed6d..be84abdcc9 100644 --- a/debian/copyright +++ b/debian/copyright @@ -4,7 +4,7 @@ Upstream-Contact: http://webchat.esper.net/?channels=ckan Source: https://github.com/KSP-CKAN/CKAN/ Files: * -Copyright: 2014-2020, the Comprehensive Kerbal Archive Network (CKAN) Authors: +Copyright: 2014-2022, the Comprehensive Kerbal Archive Network (CKAN) Authors: https://github.com/KSP-CKAN/CKAN/graphs/contributors Comment: You can use the CKAN and its associated files under the MIT license, reproduced below. This includes the right to sublicense under compatible diff --git a/doc/rpm-repo.md b/doc/rpm-repo.md new file mode 100644 index 0000000000..8662238222 --- /dev/null +++ b/doc/rpm-repo.md @@ -0,0 +1,23 @@ +## CKAN'S RPM repository + +We have created an RPM repository that you can add to your RPM-based OS to install CKAN. This will allow you to run CKAN from the system app menus or via `ckan` from your command line. Your system's package manager will pull in dependencies and update CKAN automatically. There's even a man page. + +## Stable builds + +These are [the main releases](https://github.com/KSP-CKAN/CKAN/releases), recommended for most users. You will have the same features at the same time as everyone else, but you will have the added conveniences of APT managing the updates for you. + +``` +sudo dnf config-manager --add-repo https://ksp-ckan.s3-us-west-2.amazonaws.com/rpm/stable/ckan_stable.repo +sudo dnf install ckan +``` + +## Nightly builds + +If you like to live dangerously, these are the bleeding edge builds that are generated every time we merge changes to the main branch. On the plus side, you'll get fixes and enhancements faster than everyone else. On the minus side, these builds are essentially untested; we don't know whether they're reliable until we take a close look at them and make sure they're complete and won't break things, at which point they turn into a stable build (if that sounds more like what you want, scroll up to the previous section). + +Things may break! But if they do and you report it to us, you'll be a hero to CKAN users everywhere, whether they know it or not. + +``` +sudo dnf config-manager --add-repo https://ksp-ckan.s3-us-west-2.amazonaws.com/rpm/nightly/ckan_nightly.repo +sudo dnf install ckan +``` diff --git a/rpm/Makefile b/rpm/Makefile index ba6e3e45d6..34eeb64d7b 100644 --- a/rpm/Makefile +++ b/rpm/Makefile @@ -1,4 +1,4 @@ -.PHONY: clean test +.PHONY: clean test repo # Borrow files from .deb DEBDIR:=$(shell pwd)/../debian @@ -13,7 +13,15 @@ CONFIGURATION?=Release EXESRC:=$(shell pwd)/../_build/repack/$(CONFIGURATION)/ckan.exe CHANGELOGSRC:=../CHANGELOG.md VERSION:=$(shell egrep '^\s*\#\#\s+v.*$$' $(CHANGELOGSRC) | head -1 | sed -e 's/^\s*\#\#\s\+v//' -e 's/-/_/g' ) -RPM:=$(shell pwd)/../_build/rpm/RPMS/noarch/ckan-$(VERSION)-1.noarch.rpm +RPM:=$(TOPDIR)/RPMS/noarch/ckan-$(VERSION)-1.noarch.rpm + +REPODIR:=$(TOPDIR)/repo +CODENAME?=nightly +REPOFILE:=ckan_$(CODENAME).repo +REPORPM:=$(REPODIR)/ckan-$(VERSION)-1.noarch.rpm +REPOXML:=$(REPODIR)/repodata/repomd.xml +REPOSIG:=$(REPOXML).asc +GPGNAME:=KSP CKAN # rpmbuild tries to use $HOME/rpmbuild by default # rpmbuild can't handle relative paths for its topdir @@ -24,6 +32,21 @@ $(RPM): $(SCRIPTSRC) $(EXESRC) $(MANSRC) $(DESKTOPSRC) $(ICONSRC) $(CONSOLEUIDES cp $^ "${TOPDIR}/SOURCES" rpmbuild --define "_topdir ${TOPDIR}" --define "_version $(VERSION)" -bb ckan.spec +repo: $(REPOSIG) + +$(REPOSIG): $(REPOXML) + gpg --detach-sign --armor $< + +$(REPOXML): $(REPORPM) + createrepo_c "$(REPODIR)" + +$(REPORPM): $(RPM) $(REPOFILE) + mkdir -p "$(REPODIR)" + cp $^ "$(REPODIR)" + rpm --define '%_gpg_name $(GPGNAME)' \ + --define '%__gpg $(shell which gpg)' \ + --addsign $@ + $(EXESRC): cd .. && ./build --configuration=$(CONFIGURATION) diff --git a/rpm/ckan_nightly.repo b/rpm/ckan_nightly.repo new file mode 100644 index 0000000000..393c79fb48 --- /dev/null +++ b/rpm/ckan_nightly.repo @@ -0,0 +1,6 @@ +[ckan-nightly-repo] +name=CKAN Nightly Repo +baseurl=https://ksp-ckan.s3-us-west-2.amazonaws.com/rpm/nightly +enabled=1 +gpgcheck=1 +gpgkey=https://github.com/KSP-CKAN/CKAN/raw/master/debian/repo.pub diff --git a/rpm/ckan_stable.repo b/rpm/ckan_stable.repo new file mode 100644 index 0000000000..c8c0fecdfb --- /dev/null +++ b/rpm/ckan_stable.repo @@ -0,0 +1,6 @@ +[ckan-stable-repo] +name=CKAN Stable Repo +baseurl=https://ksp-ckan.s3-us-west-2.amazonaws.com/rpm/stable +enabled=1 +gpgcheck=1 +gpgkey=https://github.com/KSP-CKAN/CKAN/raw/master/debian/repo.pub