Skip to content

Commit

Permalink
#65 optionally supply list of packages to install
Browse files Browse the repository at this point in the history
  • Loading branch information
kernelsam committed Oct 4, 2024
1 parent 5ff4a1d commit 75e1f66
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 27 deletions.
42 changes: 39 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ GitHub variable is `Linux`, `macOS`, or `Windows`.
runs-on: ubuntu-latest
steps:
- name: Install Senzing API
uses: senzing-factory/github-action-install-senzing-api@v2
uses: senzing-factory/github-action-install-senzing-api@v3
with:
senzingapi-version: production-v3
```
1. An example `.github/workflows/install-senzing-example.yaml` file
which installs a specific Senzing API verson:
which installs a specific Senzing API version:

```yaml
name: install senzing example
Expand All @@ -46,11 +46,47 @@ GitHub variable is `Linux`, `macOS`, or `Windows`.
runs-on: ubuntu-latest
steps:
- name: Install Senzing API
uses: senzing-factory/github-action-install-senzing-api@v2
uses: senzing-factory/github-action-install-senzing-api@v3
with:
senzingapi-version: 3.6.0-23160
```

1. An example `.github/workflows/install-senzing-example.yaml` file
which installs senzingapi-runtime and senzingapi-setup with a
specific Senzing API semantic version:

```yaml
name: install senzing example
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Install Senzing API
uses: senzing-factory/github-action-install-senzing-api@v3
with:
package(s)-to-install: "senzingapi-runtime senzingapi-setup"
senzingapi-version: 3.12.0
```

### package(s)-to-install

`package(s)-to-install` values can include the following:

- Version <= 3.X:
- `senzingapi`
- `senzingapi-runtime`
- `senzingapi-setup`
- `senzingapi-tools`
- `senzingdata-v<X>`
- Version >= 4.0:
- `senzingapi-poc`
- `senzingapi-runtime`
- `senzingapi-setup`
- `senzingapi-tools`

### senzingapi-version

`senzingapi-version` values can include the following:
Expand Down
10 changes: 7 additions & 3 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ description: Install Senzing API Runtime based on platform.
author: support@senzing.com

inputs:
senzingapi-runtime-version:
package(s)-to-install:
description: Space separated list of Senzing packages to install. Linux only.
default: "senzingapi-runtime"
senzingapi-version:
description: Version of Senzing API to install
required: true
default: "production-v3"

runs:
using: composite
Expand All @@ -14,7 +17,8 @@ runs:
name: Run on Linux
uses: senzing-factory/github-action-install-senzing-api/linux@v3
with:
senzingapi-runtime-version: ${{ inputs.senzingapi-runtime-version }}
senzingapi-version: ${{ inputs.senzingapi-version }}
package(s)-to-install: ${{ inputs.package(s)-to-install }}

- if: runner.os == 'macOS'
name: Run on macOS
Expand Down
14 changes: 9 additions & 5 deletions linux/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ description: Install Senzing API Runtime on the linux platform.
author: support@senzing.com

inputs:
senzingapi-runtime-version:
description: Version of Senzing API Runtime to install
required: true
package(s)-to-install:
description: Space separated list of Senzing packages to install. Linux only.
default: "senzingapi-runtime"
senzingapi-version:
description: Version of Senzing API to install
default: "production-v3"

runs:
using: composite
Expand All @@ -14,9 +17,10 @@ runs:
# Install staging, production or versioned release.

- env:
PACKAGES_TO_INSTALL: ${{ inputs.package(s)-to-install }}
SENZING_ACCEPT_EULA: I_ACCEPT_THE_SENZING_EULA
SENZING_INSTALL_VERSION: ${{ inputs.senzingapi-runtime-version }}
name: Install Senzing API Runtime
SENZING_INSTALL_VERSION: ${{ inputs.senzingapi-version }}
name: Install Senzing API
shell: bash
run: ${{ github.action_path }}/install-senzing.sh

Expand Down
44 changes: 28 additions & 16 deletions linux/install-senzing.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ set -e
configure-vars() {

# senzing apt repository packages
PROD_REPO=https://senzing-production-apt.s3.amazonaws.com
STAGING_REPO=https://senzing-staging-apt.s3.amazonaws.com
# v3 and lower
PROD_REPO_V3_AND_LOWER=https://senzing-production-apt.s3.amazonaws.com/senzingrepo_1.0.1-1_all.deb
STAGING_REPO_V3_AND_LOWER=https://senzing-staging-apt.s3.amazonaws.com/senzingstagingrepo_1.0.1-1_all.deb
PROD_REPO_V3_AND_LOWER="$PROD_REPO/senzingrepo_1.0.1-1_all.deb"
STAGING_REPO_V3_AND_LOWER="$STAGING_REPO/senzingstagingrepo_1.0.1-1_all.deb"
# v4 and above
PROD_REPO_V4_AND_ABOVE=https://senzing-production-apt.s3.amazonaws.com/senzingrepo_2.0.0-1_all.deb
STAGING_REPO_V4_AND_ABOVE=https://senzing-staging-apt.s3.amazonaws.com/senzingstagingrepo_2.0.0-1_all.deb
PROD_REPO_V4_AND_ABOVE="$PROD_REPO/senzingrepo_2.0.0-1_all.deb"
STAGING_REPO_V4_AND_ABOVE="$STAGING_REPO/senzingstagingrepo_2.0.0-1_all.deb"

# semantic versions
REGEX_SEM_VER="^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$"
Expand All @@ -25,36 +27,46 @@ configure-vars() {

if [[ $SENZING_INSTALL_VERSION =~ "production" ]]; then

echo "[INFO] install senzingapi-runtime from production"
echo "[INFO] install $PACKAGES_TO_INSTALL from production"
get-generic-major-version
is-major-version-greater-than-3 && INSTALL_REPO="$PROD_REPO_V4_AND_ABOVE" || INSTALL_REPO="$PROD_REPO_V3_AND_LOWER"
SENZING_PACKAGE="senzingapi-runtime"
SENZING_PACKAGES="$PACKAGES_TO_INSTALL"
restrict-major-version

elif [[ $SENZING_INSTALL_VERSION =~ "staging" ]]; then

echo "[INFO] install senzingapi-runtime from staging"
echo "[INFO] install $PACKAGES_TO_INSTALL from staging"
get-generic-major-version
is-major-version-greater-than-3 && INSTALL_REPO="$STAGING_REPO_V4_AND_ABOVE" || INSTALL_REPO="$STAGING_REPO_V3_AND_LOWER"
SENZING_PACKAGE="senzingapi-runtime"
SENZING_PACKAGES="$PACKAGES_TO_INSTALL"
restrict-major-version

elif [[ $SENZING_INSTALL_VERSION =~ $REGEX_SEM_VER ]]; then

echo "[INFO] install senzingapi-runtime semantic version"
echo "[INFO] install $PACKAGES_TO_INSTALL semantic version"
get-semantic-major-version
is-major-version-greater-than-3 && INSTALL_REPO="$PROD_REPO_V4_AND_ABOVE" || INSTALL_REPO="$PROD_REPO_V3_AND_LOWER"
SENZING_PACKAGE="senzingapi-runtime=$SENZING_INSTALL_VERSION*"
packages=($PACKAGES_TO_INSTALL)
for package in "${packages[@]}"
do
updated_packages+="$package=$SENZING_INSTALL_VERSION* "
done
SENZING_PACKAGES="$updated_packages"

elif [[ $SENZING_INSTALL_VERSION =~ $REGEX_SEM_VER_BUILD_NUM ]]; then

echo "[INFO] install senzingapi-runtime semantic version with build number"
echo "[INFO] install $PACKAGES_TO_INSTALL semantic version with build number"
get-semantic-major-version
is-major-version-greater-than-3 && INSTALL_REPO="$PROD_REPO_V4_AND_ABOVE" || INSTALL_REPO="$PROD_REPO_V3_AND_LOWER"
SENZING_PACKAGE="senzingapi-runtime=$SENZING_INSTALL_VERSION"
packages=($PACKAGES_TO_INSTALL)
for package in "${packages[@]}"
do
updated_packages+="$package=$SENZING_INSTALL_VERSION "
done
SENZING_PACKAGES="$updated_packages"

else
echo "[ERROR] senzingapi-runtime install version $SENZING_INSTALL_VERSION is unsupported"
echo "[ERROR] $PACKAGES_TO_INSTALL install version $SENZING_INSTALL_VERSION is unsupported"
exit 1
fi

Expand Down Expand Up @@ -148,13 +160,13 @@ install-senzing-repository() {
############################################
# install-senzingapi
# GLOBALS:
# SENZING_PACKAGE
# SENZING_PACKAGES
# full package name used for install
############################################
install-senzingapi-runtime() {

echo "[INFO] sudo --preserve-env apt-get -y install $SENZING_PACKAGE"
sudo --preserve-env apt-get -y install "$SENZING_PACKAGE"
echo "[INFO] sudo --preserve-env apt-get -y install $SENZING_PACKAGES"
sudo --preserve-env apt-get -y install "$SENZING_PACKAGES"

}

Expand Down

0 comments on commit 75e1f66

Please sign in to comment.