From 5ff93c2a6f0876afdf433997c215fd84e734adca Mon Sep 17 00:00:00 2001 From: Neil Munday Date: Sat, 16 Mar 2024 18:45:39 +0000 Subject: [PATCH] feat: Add creation of RPM repos --- .github/workflows/jekyll-gh-pages.yml | 13 +++- build-tools/create-repos.sh | 101 ++++++++++++++++++++++++++ 2 files changed, 113 insertions(+), 1 deletion(-) create mode 100755 build-tools/create-repos.sh diff --git a/.github/workflows/jekyll-gh-pages.yml b/.github/workflows/jekyll-gh-pages.yml index cda9cf4..0ba9f12 100644 --- a/.github/workflows/jekyll-gh-pages.yml +++ b/.github/workflows/jekyll-gh-pages.yml @@ -32,18 +32,29 @@ jobs: run: | cp README.md pages/index.md cp CHANGELOG.md TEMPLATES.md pages/ - mkdir -p pages/tests/unit pages/tests/integration pages/tests/integration/docker-slurm + mkdir -p pages/repo pages/tests/unit pages/tests/integration pages/tests/integration/docker-slurm cp tests/unit/README.md pages/tests/unit/index.md cp tests/integration/README.md pages/tests/integration/index.md cp tests/integration/docker-slurm/README.md pages/tests/integration/docker-slurm/index.md sed -i 's#../../#https://github.com/neilmunday/slurm-mail/blob/main/#g' pages/tests/integration/index.md - name: Setup Pages uses: actions/configure-pages@v4 + - name: Install required packages + run: | + sudo apt update + sudo apt install -y jq createrepo-c + - name: Create repos + env: + GH_TOKEN: ${{ github.token }} + run: | + build-tools/create-repos.sh -o $(realpath pages/repo) - name: Build with Jekyll uses: actions/jekyll-build-pages@v1 with: source: ./pages destination: ./_site + - name: Set permissions on the _site directory + run: sudo chown -R runner:docker _site - name: Upload artifact uses: actions/upload-pages-artifact@v3 diff --git a/build-tools/create-repos.sh b/build-tools/create-repos.sh new file mode 100755 index 0000000..2979478 --- /dev/null +++ b/build-tools/create-repos.sh @@ -0,0 +1,101 @@ +#!/bin/bash + +# +# This file is part of Slurm-Mail. +# +# Slurm-Mail is a drop in replacement for Slurm's e-mails to give users +# much more information about their jobs compared to the standard Slurm +# e-mails. +# +# Copyright (C) 2018-2024 Neil Munday (neil@mundayweb.com) +# +# Slurm-Mail 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. +# +# Slurm-Mail 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 Slurm-Mail. If not, see . +# + +# +# This is a helper script to create package repos for the latest +# release of Slurm-Mail. +# + +set -e + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +source $DIR/common.sh + +function usage { + echo "Usage: $0 -o path" 1>&2 + echo " -o output path" + exit 1 +} + +while getopts ":o:" options; do + case "${options}" in + o) + OUTPUT_DIR=${OPTARG} + ;; + :) + echo "Error: -${OPTARG} requires a value" + usage + ;; + *) + usage + ;; + esac +done + +if [ -z $OUTPUT_DIR ]; then + usage +fi + +check_dir $OUTPUT_DIR + +echo "repos will be written to: $OUTPUT_DIR" + +RHEL_OSES=" +amzn2 +el7 +el8 +el9 +sl15 +" + +for OS in $RHEL_OSES; do + cd $DIR + echo "processing: $OS" + REPO_DIR="$OUTPUT_DIR/$OS" + mkdir -p $REPO_DIR + echo "downloading RPM..." + gh release download --pattern "*${OS}.noarch.rpm" -D $REPO_DIR + echo "creating repo" + cd $REPO_DIR + createrepo_c . +done + +DEB_OSES=" +ub20 +ub22 +" + +#@TODO: support creation of debian repos + +#for OS in $DEB_OSES; do +# cd $DIR +# echo "processing: $OS" +# REPO_DIR="$OUTPUT_DIR/$OS" +# mkdir -p $REPO_DIR +# echo "downloading DEB..." +# gh release download --pattern "*${OS}-ubuntu1_all.deb" -D $REPO_DIR +# cd $REPO_DIR +#done