diff --git a/README.md b/README.md index 6c2003f..504bc1c 100644 --- a/README.md +++ b/README.md @@ -2,12 +2,7 @@ This action builds an validates Arch Linux package. The `PKGBUILD` and `.SRCINFO` files should be under a subdirectory named the same as the `pkgbuild` of the package. - -This assumption made is so that this action works well with [aurpublish] (_untested in this fork yet_). - -This version is a fork from the original [arch-pkgbuild-builder](https://github.com/2m/arch-pkgbuild-builder). - -It differs in that the `PKGBUILD` and related files do not need to be place in the root of the github workspace. +This assumption is made so this action works well with [aurpublish]. [aurpublish]: https://github.com/eli-schwartz/aurpublish @@ -28,10 +23,10 @@ It differs in that the `PKGBUILD` and related files do not need to be place in t Verifies and builds the package. ```yml -uses: grumlimited/arch-pkgbuild-builder@v1 +uses: 2m/arch-pkgbuild-builder@v1 with: target: 'pkgbuild' - pkgname: 'data/arch/authenticator-rs/PKGBUILD' + pkgname: 'ucm-bin' ``` ### srcinfo @@ -39,7 +34,7 @@ with: Verifies if the `.SRCINFO` is up to date with the `PKGBUILD`. ```yml -uses: grumlimited/arch-pkgbuild-builder@v1 +uses: 2m/arch-pkgbuild-builder@v1 with: target: 'srcinfo' pkgname: 'ucm-bin' @@ -50,7 +45,7 @@ with: Installs the package and runs a given `command`. ```yml -uses: grumlimited/arch-pkgbuild-builder@v1 +uses: 2m/arch-pkgbuild-builder@v1 with: target: 'run' pkgname: 'ucm-bin' @@ -61,4 +56,4 @@ with: So far this action is used by the following packages: -* [authenticator-rs](https://github.com/grumlimited/authenticator-rs) +* [ucm-bin](https://github.com/2m/ucm-bin-pkgbuild) diff --git a/action.yml b/action.yml index 5976bf0..931df57 100644 --- a/action.yml +++ b/action.yml @@ -6,8 +6,8 @@ branding: color: 'blue' inputs: - pkgbuild: - description: 'Path to file PKGBUILD. Assumes to be placed in a directory with the name of package, ie /path/to/pkgname' + pkgname: + description: 'Path to DIRECTORY where the PKGBUILD file is. Assumes the directory is the name of package, ie /path/to/pkgname/' required: true target: description: 'Validation target. Can be one of: "pkgbuild", "srcinfo"' @@ -16,11 +16,15 @@ inputs: command: description: 'Command to run after package installation' required: false + debug: + description: 'Turns debugging on' + required: false runs: using: 'docker' image: 'Dockerfile' args: - ${{ inputs.target }} - - ${{ inputs.pkgbuild }} + - ${{ inputs.pkgname }} - ${{ inputs.command }} + - ${{ inputs.debug }} diff --git a/entrypoint.sh b/entrypoint.sh index 3b44062..0102923 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,21 +1,38 @@ #!/bin/sh -l +DEBUG=$4 + +if [[ -n $DEBUG && $DEBUG = true ]]; then + set -x +fi + target=$1 -pkgbuild=$2 +pkgname=$2 command=$3 # assumes that package files are in a subdirectory # of the same name as "pkgname", so this works well # with "aurpublish" tool -pkgbuild_dir=$(dirname $(readlink $pkgbuild -f)) -cd $pkgbuild_dir || exit +if [[ ! -d $pkgname ]]; then + echo "$pkgname should be a directory." + exit 1 +fi + +if [[ ! -e $pkgname/PKGBUILD ]]; then + echo "$pkgname does not contain a PKGBUILD file." + exit 1 +fi + +pkgbuild_dir=$(readlink $pkgname -f) # nicely cleans up path, ie. ///dsq/dqsdsq/my-package//// -> /dsq/dqsdsq/my-package # '/github/workspace' is mounted as a volume and has owner set to root -# set the owner to the 'build' user, so it can access package files +# set the owner of $pkgbuild_dir to the 'build' user, so it can access package files. sudo chown -R build $pkgbuild_dir -pkgname=$(basename $pkgbuild_dir) +cd $pkgbuild_dir + +pkgname="$(basename $pkgbuild_dir)" # keep quotes in case someone passes in a directory path with whitespaces... install_deps() { # install make and regular package dependencies