Only deploy when set #14
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Accumulo snapshot and update DataWave to use | |
on: | |
push: | |
branches: | |
- '**' | |
workflow_dispatch: | |
inputs: | |
accumuloBranch: | |
required: false | |
description: "Branch name to build. Will be used as image tag." | |
accumuloRepo: | |
required: false | |
description: "Accumulo Repo to use. Expected to be at Github. Example: apache/accumulo" | |
deployAccumulo: | |
required: false | |
description: "Set to false if this accumulo version has already been pushed to Github Packages" | |
schedule: | |
- cron: "0 0 * * *" | |
# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds. | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository.lowercase }} | |
JAVA_VERSION: '17' | |
JAVA_DISTRIBUTION: 'zulu' #This is the default on v1 of the action for 1.8 | |
USER_NAME: ${{ secrets.GHCR_WRITE_USER_NAME }} | |
ACCESS_TOKEN: ${{ secrets.GHCR_WRITE_ACCESS_TOKEN }} | |
jobs: | |
build-and-deploy-accumulo: | |
runs-on: ubuntu-latest | |
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job. | |
permissions: | |
contents: read | |
packages: write | |
# | |
steps: | |
- name: Checkout DataWave | |
uses: actions/checkout@v4 | |
with: | |
path: datawave | |
- name: Checkout Accumulo | |
uses: actions/checkout@v4.2.0 | |
id: accumuloCheckout | |
with: | |
repository: ${{ github.event.inputs.accumuloRepo || 'apache/accumulo' }} | |
path: accumulo | |
ref: ${{ github.event.inputs.accumuloBranch || '2.1' }} | |
- name: Set up JDK ${{env.JAVA_VERSION}} | |
uses: actions/setup-java@v3 | |
with: | |
distribution: ${{env.JAVA_DISTRIBUTION}} | |
java-version: ${{env.JAVA_VERSION}} | |
cache: 'maven' | |
- name: Get Accumulo Version | |
id: get-accumulo-version | |
run: | | |
cd $GITHUB_WORKSPACE/accumulo | |
mvn build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.incrementalVersion}-$(git rev-parse --short HEAD) | |
export NEWVERSION=$(mvn -q help:evaluate -DforceStdout -Dexpression=project.version) | |
echo accumuloversion=$NEWVERSION >> $GITHUB_OUTPUT | |
- name: Deploy Accumulo | |
if: ${{ ( github.event.inputs.deployAccumulo || 'false' ) == 'true'}} | |
run: | | |
cd $GITHUB_WORKSPACE/accumulo | |
mvn -DaltDeploymentRepository=github-datawave::https://maven.pkg.github.com/NationalSecurityAgency/datawave -V -B -e -ntp "-Dstyle.color=always" -DskipTests -T1C clean deploy -s $GITHUB_WORKSPACE/datawave/.github/workflows/settings.xml | |
- name: Log in to the Container registry | |
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ env.USER_NAME }} | |
password: ${{ env.ACCESS_TOKEN }} | |
- name: Update DataWave Dependency Version | |
run: | | |
cd $GITHUB_WORKSPACE/datawave | |
mvn -s $GITHUB_WORKSPACE/datawave/.github/workflows/settings.xml versions:set-property -Dproperty=version.accumulo -DnewVersion=${{ steps.get-accumulo-version.outputs.accumuloversion }} -DgenerateBackupPoms=false | |
- name: Build Web and Ingest Docker Images (Maven) | |
run: | | |
cd $GITHUB_WORKSPACE/datawave | |
mvn -s $GITHUB_WORKSPACE/datawave/.github/workflows/settings.xml clean install -Prpm,kubernetes,assemble,deploy-ws -Ddist -Pdocker -DpushImage -Ddocker-release -DskipTests | |