Enable action to be used as a package builder
This commit adds options to enable the action to be used inside a CI based mirror deployment. To enable this, the `pkg`,`copy_all_sources`, `makepkg_gpg` and `mirror` options were added to the action. Signed-off-by: Wachtl Enterprises LLC <tyrolyean@escpe.net>
This commit is contained in:
parent
4de74c453f
commit
31aeba634f
3 changed files with 50 additions and 3 deletions
|
@ -2,7 +2,7 @@
|
|||
FROM docker.io/library/archlinux:base-devel
|
||||
|
||||
# Install dependencies
|
||||
RUN pacman -Syu --needed --noconfirm pacman-contrib namcap git
|
||||
RUN pacman -Syu --needed --noconfirm pacman-contrib namcap git bash procps-ng
|
||||
|
||||
# Setup user
|
||||
RUN useradd -m builder && \
|
||||
|
|
22
action.yml
22
action.yml
|
@ -39,6 +39,22 @@ inputs:
|
|||
description: 'Resolve dependencies using paru'
|
||||
default: 'false'
|
||||
required: false
|
||||
pkg:
|
||||
description: 'Copy built packages to workdir'
|
||||
default: 'false'
|
||||
required: false
|
||||
copy_all_sources:
|
||||
description: 'Copy all files in the source directory to the build directory'
|
||||
default: 'false'
|
||||
required: false
|
||||
makepkg_gpg:
|
||||
description: 'GPG keys that will be passed to gpg --recv-keys for dowloading'
|
||||
default: ''
|
||||
required: false
|
||||
mirror:
|
||||
description: 'Specify mirror to be used'
|
||||
default: ''
|
||||
required: false
|
||||
update_archlinux_keyring:
|
||||
description: 'Update archlinux-keyring'
|
||||
default: 'true'
|
||||
|
@ -46,7 +62,7 @@ inputs:
|
|||
|
||||
runs:
|
||||
using: 'docker'
|
||||
image: 'docker://ghcr.io/heyhusen/archlinux-package-action:2'
|
||||
image: 'Dockerfile'
|
||||
args:
|
||||
- ${{ inputs.path }}
|
||||
- ${{ inputs.pkgver }}
|
||||
|
@ -56,4 +72,8 @@ runs:
|
|||
- ${{ inputs.flags }}
|
||||
- ${{ inputs.namcap }}
|
||||
- ${{ inputs.aur }}
|
||||
- ${{ inputs.pkg }}
|
||||
- ${{ inputs.mirror }}
|
||||
- ${{ inputs.makepkg_gpg }}
|
||||
- ${{ inputs.copy_all_files }}
|
||||
- ${{ inputs.update_archlinux_keyring }}
|
||||
|
|
|
@ -10,9 +10,22 @@ cd $HOME
|
|||
mkdir gh-action
|
||||
cd gh-action
|
||||
cp -rfv "$GITHUB_WORKSPACE"/.git ./
|
||||
cp -fv "$WORKPATH"/PKGBUILD ./
|
||||
|
||||
if [[ $INPUT_COPY_ALL_SOURCES == true ]]; then
|
||||
cp -fv "$WORKPATH"/* ./
|
||||
else
|
||||
|
||||
cp -fv "$WORKPATH"/PKGBUILD ./
|
||||
fi
|
||||
echo "::endgroup::"
|
||||
|
||||
# Set mirror
|
||||
if [[ -n $INPUT_MIRROR ]]; then
|
||||
echo "::group::Setting mirror to $INPUT_MIRROR"
|
||||
sudo bash -c "echo Server = ${INPUT_MIRROR@Q} > /etc/pacman.d/mirrorlist"
|
||||
echo "::endgroup::"
|
||||
fi
|
||||
|
||||
# Update archlinux-keyring
|
||||
if [[ $INPUT_ARCHLINUX_KEYRING == true ]]; then
|
||||
echo "::group::Updating archlinux-keyring"
|
||||
|
@ -67,6 +80,13 @@ if [[ $INPUT_AUR == true ]]; then
|
|||
echo "::endgroup::"
|
||||
fi
|
||||
|
||||
# import gpg keys into keyring
|
||||
if [[ -n $INPUT_MAKEPKG_GPG ]]; then
|
||||
echo "::group::Import GPG keys into keyring"
|
||||
gpg --recv-keys $INPUT_MAKEPKG_GPG
|
||||
echo "::endgroup::"
|
||||
fi
|
||||
|
||||
# Run makepkg
|
||||
if [[ -n $INPUT_FLAGS ]]; then
|
||||
echo "::group::Running makepkg with flags"
|
||||
|
@ -74,6 +94,13 @@ if [[ -n $INPUT_FLAGS ]]; then
|
|||
echo "::endgroup::"
|
||||
fi
|
||||
|
||||
# Copy built packages back to workdir if user specified
|
||||
if [[ $INPUT_PKG == true ]]; then
|
||||
echo "::group::Copy built packages to workdir"
|
||||
sudo cp -fv *.pkg.tar.* "$WORKPATH"/
|
||||
echo "::endgroup::"
|
||||
fi
|
||||
|
||||
echo "::group::Copying files from $HOME/gh-action to $WORKPATH"
|
||||
sudo cp -fv PKGBUILD "$WORKPATH"/PKGBUILD
|
||||
if [[ -e .SRCINFO ]]; then
|
||||
|
|
Loading…
Add table
Reference in a new issue