diff --git a/.project b/.project
deleted file mode 100644
index 604d276..0000000
--- a/.project
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
- github-action-install-senzing
-
diff --git a/README.md b/README.md
index 82d7089..6d27a36 100644
--- a/README.md
+++ b/README.md
@@ -7,19 +7,19 @@ A GitHub Action for installing the Senzing API.
## Overview
The GitHub Action performs a
-[system install](https://github.com/Senzing/knowledge-base/blob/main/WHATIS/senzing-system-installation.md)
+[system install]
of the Senzing API.
The GitHub Action works where the
-[RUNNER_OS](https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables)
+[RUNNER_OS]
GitHub variable is `Linux`, `macOS`, or `Windows`.
## Usage
1. An example `.github/workflows/install-senzing-example.yaml` file
- which installs the latest Senzing API:
+ which installs the latest released Senzing API:
```yaml
- name: install-senzing-example.yaml
+ name: install senzing example
on: [push]
@@ -28,14 +28,16 @@ GitHub variable is `Linux`, `macOS`, or `Windows`.
runs-on: ubuntu-latest
steps:
- name: Install Senzing API
- uses: Senzing/github-action-install-senzing-api@latest
+ uses: senzing-factory/github-action-install-senzing-api@v2
+ with:
+ senzingapi-version: production-v3
```
1. An example `.github/workflows/install-senzing-example.yaml` file
which installs a specific Senzing API verson:
```yaml
- name: install-senzing-example.yaml
+ name: install senzing example
on: [push]
@@ -44,9 +46,26 @@ GitHub variable is `Linux`, `macOS`, or `Windows`.
runs-on: ubuntu-latest
steps:
- name: Install Senzing API
- uses: Senzing/github-action-install-senzing-api@latest
+ uses: senzing-factory/github-action-install-senzing-api@v2
with:
senzingapi-version: 3.6.0-23160
```
- If `senzingapi-version` is not specified, the default is "latest".
+### senzingapi-version
+
+`senzingapi-version` values can include the following:
+- `production-v`
+ - Ex. `production-v3`
+ - This will install the latest version of the respective major version from *production*.
+- `staging-v`
+ - Ex. `staging-v3`
+ - This will install the latest version of the respective major version from *staging*.
+- `X.Y.Z`
+ - Ex. `3.8.2`
+ - This will install the latest build of the respective semantic version from *production*.
+- `X.Y.Z-ABCDE`
+ - Ex. `3.8.3-24043`
+ - This will install the exact version supplied from *production*.
+
+[RUNNER_OS]: https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables
+[system install]: https://github.com/senzing-garage/knowledge-base/blob/main/WHATIS/senzing-system-installation.md
\ No newline at end of file
diff --git a/action.yaml b/action.yaml
index a5dd5c8..6cbb9be 100644
--- a/action.yaml
+++ b/action.yaml
@@ -5,27 +5,26 @@ author: support@senzing.com
inputs:
senzingapi-version:
description: Version of Senzing API to install
- required: false
- default: latest
+ required: true
runs:
using: composite
steps:
- if: runner.os == 'Linux'
name: Run on Linux
- uses: Senzing/github-action-install-senzing/linux@latest
+ uses: senzing-factory/github-action-install-senzing/linux@"#52-skern"
with:
senzingapi-version: ${{ inputs.senzingapi-version }}
- if: runner.os == 'macOS'
name: Run on macOS
- uses: Senzing/github-action-install-senzing/darwin@latest
+ uses: senzing-factory/github-action-install-senzing/darwin@"#52-skern"
with:
senzingapi-version: ${{ inputs.senzingapi-version }}
- if: runner.os == 'Windows'
name: Run on Windows
- uses: Senzing/github-action-install-senzing/windows@latest
+ uses: senzing-factory/github-action-install-senzing/windows@"#52-skern"
with:
senzingapi-version: ${{ inputs.senzingapi-version }}
diff --git a/darwin/action.yaml b/darwin/action.yaml
index 85995b4..7287762 100644
--- a/darwin/action.yaml
+++ b/darwin/action.yaml
@@ -1,4 +1,3 @@
-# darwin/action.yaml
name: Install Senzing - darwin
description: Install Senzing API on the darwin/macOS platform.
author: support@senzing.com
@@ -6,34 +5,19 @@ author: support@senzing.com
inputs:
senzingapi-version:
description: Version of Senzing API to install
- required: false
- default: latest
+ required: true
runs:
using: composite
steps:
- # Download staging, latest, or versioned image.
- - if: inputs.senzingapi-version == 'staging'
- env:
- SENZINGAPI_STAGING_URL: https://public-read-access.s3.amazonaws.com/staging/senzingapi_staging.dmg
- name: Download staging Senzing API
- shell: bash
- run: curl --output /tmp/senzingapi.dmg $SENZINGAPI_STAGING_URL
-
- - if: inputs.senzingapi-version == 'latest'
- env:
- SENZINGAPI_LATEST_URL: https://public-read-access.s3.amazonaws.com/staging/senzingapi_latest.dmg
- name: Download Senzing API
- shell: bash
- run: curl --output /tmp/senzingapi.dmg $SENZINGAPI_LATEST_URL
+ # Download latest staging or production image.
- - if: ${{ inputs.senzingapi-version != 'latest' && inputs.senzingapi-version != 'staging' }}
- env:
- SENZINGAPI_LATEST_URL: https://public-read-access.s3.amazonaws.com/staging/senzingapi_latest.dmg
- name: Download versioned Senzing API
+ - env:
+ SENZING_INSTALL_VERSION: ${{ inputs.senzingapi-version }}
+ name: Install Senzing API
shell: bash
- run: curl --output /tmp/senzingapi.dmg $SENZINGAPI_LATEST_URL
+ run: ${{ github.action_path }}/darwin/download-senzing.sh
# Install Senzing API.
diff --git a/darwin/download-senzing.sh b/darwin/download-senzing.sh
new file mode 100755
index 0000000..3c32b1e
--- /dev/null
+++ b/darwin/download-senzing.sh
@@ -0,0 +1,71 @@
+#!/usr/bin/env bash
+set -e
+
+############################################
+# configure-vars
+# GLOBALS:
+# SENZING_INSTALL_VERSION
+# one of: production-v, staging-v
+############################################
+configure-vars() {
+
+ if [[ $SENZING_INSTALL_VERSION =~ "production" ]]; then
+
+ echo "[INFO] install senzingapi from production"
+ SENZINGAPI_URI="s3://public-read-access/MacOS_API/"
+ SENZINGAPI_URL="https://public-read-access.s3.amazonaws.com/MacOS_API"
+
+ elif [[ $SENZING_INSTALL_VERSION =~ "staging" ]]; then
+
+ echo "[INFO] install senzingapi from staging"
+ SENZINGAPI_URI="s3://public-read-access/staging/"
+ SENZINGAPI_URL="https://public-read-access.s3.amazonaws.com/staging"
+
+ else
+ echo "[ERROR] senzingapi install version $SENZING_INSTALL_VERSION is unsupported"
+ exit 1
+ fi
+
+}
+
+############################################
+# determine-latest-dmg-for-major-version
+# GLOBALS:
+# SENZING_INSTALL_VERSION
+# one of: production-v, staging-v
+# SENZINGAPI_URI
+############################################
+determine-latest-dmg-for-major-version() {
+
+ major_version=$(echo "$SENZING_INSTALL_VERSION" | grep -Eo '[0-9]+$')
+ echo "[INFO] major version is: $major_version"
+
+ aws s3 ls $SENZINGAPI_URI --recursive --no-sign-request | grep -o -E '[^ ]+$' > /tmp/staging-versions
+ latest_staging_version=$(cat /tmp/staging-versions | grep _$major_version | sort -r | head -n 1 | awk -F'/' ' { print $NF } ')
+ rm /tmp/staging-versions
+ echo "[INFO] latest staging version is: $latest_staging_version"
+
+ SENZINGAPI_DMG_URL="$SENZINGAPI_URL/$latest_staging_version"
+
+}
+
+############################################
+# download-dmg
+# GLOBALS:
+# SENZINGAPI_DMG_URL
+############################################
+download-dmg() {
+
+ echo "[INFO] curl --output /tmp/senzingapi.dmg $SENZINGAPI_DMG_URL"
+ curl --output /tmp/senzingapi.dmg $SENZINGAPI_DMG_URL
+
+}
+
+############################################
+# Main
+############################################
+
+echo "[INFO] senzing version to install is: $SENZING_INSTALL_VERSION"
+configure-vars
+determine-latest-dmg-for-major-version
+download-dmg
diff --git a/linux/action.yaml b/linux/action.yaml
index a162f66..7edccd0 100644
--- a/linux/action.yaml
+++ b/linux/action.yaml
@@ -1,4 +1,3 @@
-# linux/action.yaml
name: Install Senzing - linux
description: Install Senzing API on the linux platform.
author: support@senzing.com
@@ -12,41 +11,15 @@ inputs:
runs:
using: composite
steps:
- # Download production or staging APT repository.
- - if: inputs.senzingapi-version == 'staging'
- name: Download Senzing staging repository metadata
- shell: bash
- run: wget -qO /tmp/senzingrepo.deb https://senzing-staging-apt.s3.amazonaws.com/senzingstagingrepo_1.0.1-1_all.deb
-
- - if: inputs.senzingapi-version != 'staging'
- name: Download Senzing repository metadata
- shell: bash
- run: wget -qO /tmp/senzingrepo.deb https://senzing-production-apt.s3.amazonaws.com/senzingrepo_1.0.1-1_all.deb
+ # Install staging, production or versioned release.
- # Install repository metadata.
-
- - name: Install Senzing APT repository
- shell: bash
- run: |
- sudo apt-get -y install /tmp/senzingrepo.deb
- sudo apt-get update
-
- # Install staging, latest or versioned release.
-
- - if: ${{ inputs.senzingapi-version == 'staging' || inputs.senzingapi-version == 'latest' }}
- env:
+ - env:
SENZING_ACCEPT_EULA: I_ACCEPT_THE_SENZING_EULA
+ SENZING_INSTALL_VERSION: ${{ inputs.senzingapi-version }}
name: Install Senzing API
shell: bash
- run: sudo --preserve-env apt-get -y install senzingapi
-
- - if: ${{ inputs.senzingapi-version != 'staging' && inputs.senzingapi-version != 'latest' }}
- env:
- SENZING_ACCEPT_EULA: I_ACCEPT_THE_SENZING_EULA
- name: Install versioned Senzing API
- shell: bash
- run: sudo --preserve-env apt-get -y install senzingapi=${{ inputs.senzingapi-version }}
+ run: ${{ github.action_path }}/linux/install-senzing.sh
# Adjust files for "system install".
diff --git a/linux/install-senzing.sh b/linux/install-senzing.sh
new file mode 100755
index 0000000..8cf904e
--- /dev/null
+++ b/linux/install-senzing.sh
@@ -0,0 +1,111 @@
+#!/usr/bin/env bash
+set -e
+
+############################################
+# configure-vars
+# GLOBALS:
+# SENZING_INSTALL_VERSION
+# one of: production-v, staging-v
+# X.Y.Z, X.Y.Z-ABCDE
+############################################
+configure-vars() {
+
+ # senzing apt repository packages
+ PROD_REPO=https://senzing-production-apt.s3.amazonaws.com/senzingrepo_1.0.1-1_all.deb
+ STAGING_REPO=https://senzing-staging-apt.s3.amazonaws.com/senzingstagingrepo_1.0.1-1_all.deb
+
+ # semantic versions
+ REGEX_SEM_VER="^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$"
+ # semantic version with build number
+ REGEX_SEM_VER_BUILD_NUM="^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)-([0-9]){5}$"
+
+ if [[ $SENZING_INSTALL_VERSION =~ "production" ]]; then
+
+ echo "[INFO] install senzingapi from production"
+ INSTALL_REPO="$PROD_REPO"
+ SENZING_PACKAGE="senzingapi"
+ restrict-major-version
+
+ elif [[ $SENZING_INSTALL_VERSION =~ "staging" ]]; then
+
+ echo "[INFO] install senzingapi from staging"
+ INSTALL_REPO="$STAGING_REPO"
+ SENZING_PACKAGE="senzingapi"
+ restrict-major-version
+
+ elif [[ $SENZING_INSTALL_VERSION =~ $REGEX_SEM_VER ]]; then
+
+ echo "[INFO] install senzingapi semantic version"
+ INSTALL_REPO="$PROD_REPO"
+ SENZING_PACKAGE="senzingapi=$SENZING_INSTALL_VERSION*"
+
+ elif [[ $SENZING_INSTALL_VERSION =~ $REGEX_SEM_VER_BUILD_NUM ]]; then
+
+ echo "[INFO] install senzingapi semantic version with build number"
+ INSTALL_REPO="$PROD_REPO"
+ SENZING_PACKAGE="senzingapi=$SENZING_INSTALL_VERSION"
+
+ else
+ echo "[ERROR] senzingapi install version $SENZING_INSTALL_VERSION is unsupported"
+ exit 1
+ fi
+
+}
+
+############################################
+# install-senzing-repository
+# GLOBALS:
+# SENZING_INSTALL_VERSION
+# one of: production-v, staging-v
+# semver does not apply here
+############################################
+restrict-major-version() {
+
+ MAJOR_VERSION=$(echo "$SENZING_INSTALL_VERSION" | grep -Eo '[0-9]+$')
+ senzingapi_preferences_file="/etc/apt/preferences.d/senzingapi"
+ echo "[INFO] restrict senzingapi major version to: $MAJOR_VERSION"
+
+ echo "Package: senzingapi" | sudo tee -a $senzingapi_preferences_file
+ echo "Pin: version $MAJOR_VERSION.*" | sudo tee -a $senzingapi_preferences_file
+ echo "Pin-Priority: 999" | sudo tee -a $senzingapi_preferences_file
+
+}
+
+############################################
+# install-senzing-repository
+# GLOBALS:
+# INSTALL_REPO
+# APT Repository Package URL
+############################################
+install-senzing-repository() {
+
+ echo "[INFO] wget -qO /tmp/senzingrepo.deb $INSTALL_REPO"
+ wget -qO /tmp/senzingrepo.deb $INSTALL_REPO
+ echo "[INFO] sudo apt-get -y install /tmp/senzingrepo.deb"
+ sudo apt-get -y install /tmp/senzingrepo.deb
+ echo "[INFO] sudo apt-get update"
+ sudo apt-get update
+
+}
+
+############################################
+# install-senzingapi
+# GLOBALS:
+# SENZING_PACKAGE
+# full package name used for install
+############################################
+install-senzingapi() {
+
+ echo "[INFO] sudo --preserve-env apt-get -y install $SENZING_PACKAGE"
+ sudo --preserve-env apt-get -y install "$SENZING_PACKAGE"
+
+}
+
+############################################
+# Main
+############################################
+
+echo "[INFO] senzing version to install is: $SENZING_INSTALL_VERSION"
+configure-vars
+install-senzing-repository
+install-senzingapi
\ No newline at end of file
diff --git a/windows/action.yaml b/windows/action.yaml
index 82db763..4b9c3f9 100644
--- a/windows/action.yaml
+++ b/windows/action.yaml
@@ -6,34 +6,19 @@ author: support@senzing.com
inputs:
senzingapi-version:
description: Version of Senzing API to install
- required: false
- default: latest
+ required: true
runs:
using: composite
steps:
- # Download staging, latest, or versioned image.
- - if: inputs.senzingapi-version == 'staging'
- env:
- SENZINGAPI_STAGING_URL: https://public-read-access.s3.amazonaws.com/staging/SenzingAPI_staging.zip
- name: Download staging Senzing API
- shell: cmd
- run: curl --output senzingapi.zip %SENZINGAPI_STAGING_URL%
-
- - if: inputs.senzingapi-version == 'latest'
- env:
- SENZINGAPI_LATEST_URL: https://public-read-access.s3.amazonaws.com/staging/SenzingAPI_latest.zip
- name: Download Senzing API
- shell: cmd
- run: curl --output senzingapi.zip %SENZINGAPI_LATEST_URL%
+ # Download latest staging or production image.
- - if: ${{ inputs.senzingapi-version != 'latest' && inputs.senzingapi-version != 'staging' }}
- env:
- SENZINGAPI_LATEST_URL: https://public-read-access.s3.amazonaws.com/staging/SenzingAPI_latest.zip
- name: Download versioned Senzing API
- shell: cmd
- run: curl --output senzingapi.zip %SENZINGAPI_LATEST_URL%
+ - env:
+ SENZING_INSTALL_VERSION: ${{ inputs.senzingapi-version }}
+ name: Install Senzing API
+ shell: bash
+ run: ${{ github.action_path }}/windows/download-senzing.sh
# Install Senzing API.
diff --git a/windows/download-senzing.sh b/windows/download-senzing.sh
new file mode 100755
index 0000000..c77cd9f
--- /dev/null
+++ b/windows/download-senzing.sh
@@ -0,0 +1,71 @@
+#!/usr/bin/env bash
+set -e
+
+############################################
+# configure-vars
+# GLOBALS:
+# SENZING_INSTALL_VERSION
+# one of: production-v, staging-v
+############################################
+configure-vars() {
+
+ if [[ $SENZING_INSTALL_VERSION =~ "production" ]]; then
+
+ echo "[INFO] install senzingapi from production"
+ SENZINGAPI_URI="s3://public-read-access/Windows_API/"
+ SENZINGAPI_URL="https://public-read-access.s3.amazonaws.com/Windows_API"
+
+ elif [[ $SENZING_INSTALL_VERSION =~ "staging" ]]; then
+
+ echo "[INFO] install senzingapi from staging"
+ SENZINGAPI_URI="s3://public-read-access/staging/"
+ SENZINGAPI_URL="https://public-read-access.s3.amazonaws.com/staging"
+
+ else
+ echo "[ERROR] senzingapi install version $SENZING_INSTALL_VERSION is unsupported"
+ exit 1
+ fi
+
+}
+
+############################################
+# determine-latest-zip-for-major-version
+# GLOBALS:
+# SENZING_INSTALL_VERSION
+# one of: production-v, staging-v
+# SENZINGAPI_URI
+############################################
+determine-latest-zip-for-major-version() {
+
+ major_version=$(echo "$SENZING_INSTALL_VERSION" | grep -Eo '[0-9]+$')
+ echo "[INFO] major version is: $major_version"
+
+ aws s3 ls $SENZINGAPI_URI --recursive --no-sign-request | grep -o -E '[^ ]+$' > /tmp/staging-versions
+ latest_staging_version=$(cat /tmp/staging-versions | grep _$major_version | sort -r | head -n 1 | awk -F'/' ' { print $NF } ')
+ rm /tmp/staging-versions
+ echo "[INFO] latest staging version is: $latest_staging_version"
+
+ SENZINGAPI_ZIP_URL="$SENZINGAPI_URL/$latest_staging_version"
+
+}
+
+############################################
+# download-zip
+# GLOBALS:
+# SENZINGAPI_ZIP_URL
+############################################
+download-zip() {
+
+ echo "[INFO] curl --output senzingapi.zip $SENZINGAPI_ZIP_URL"
+ curl --output /tmp/senzingapi.zip $SENZINGAPI_ZIP_URL
+
+}
+
+############################################
+# Main
+############################################
+
+echo "[INFO] senzing version to install is: $SENZING_INSTALL_VERSION"
+configure-vars
+determine-latest-zip-for-major-version
+download-zip