Skip to content

Publish Hazelcast OS & EE packages (``@) #2182

Publish Hazelcast OS & EE packages (``@)

Publish Hazelcast OS & EE packages (``@) #2182

name: Publish Hazelcast OS & EE packages
run-name: ${{ github.workflow }} (`${{ inputs.VERSION }}`@${{ inputs.ENVIRONMENT }})
on:
push:
branches:
- master
pull_request:
workflow_dispatch:
inputs:
VERSION:
description: 'The version to build'
required: true
PACKAGE_TYPES:
description: 'Packages to build'
required: true
default: 'all'
type: choice
options:
- all
- deb
- rpm
- homebrew
RELEASE_TYPE:
description: 'Which editions should be built'
required: true
default: 'EE'
type: choice
options:
- ALL
- OSS
- EE
ENVIRONMENT:
description: 'Environment to use'
required: true
default: 'live'
type: environment
env:
EVENT_NAME: ${{ github.event_name }}
concurrency:
group: '${{ github.workflow }}-${{ github.base_ref || github.ref_name}}'
jobs:
prepare:
runs-on: ubuntu-latest
env:
RELEASE_TYPE: ${{ inputs.RELEASE_TYPE || 'EE' }}
PACKAGE_TYPES: ${{ inputs.PACKAGE_TYPES || 'all' }}
outputs:
hz_version: ${{ steps.hz_version_step.outputs.hz_version }}
should_build_oss: ${{ steps.resolve-editions.outputs.should_build_oss == 'true' || github.event_name == 'pull_request' }}
should_build_ee: ${{ steps.resolve-editions.outputs.should_build_ee == 'true' || github.event_name == 'pull_request'}}
should_build_deb: ${{ env.PACKAGE_TYPES == 'all' || env.PACKAGE_TYPES == 'deb' }}
should_build_rpm: ${{ env.PACKAGE_TYPES == 'all' || env.PACKAGE_TYPES == 'rpm' }}
should_build_homebrew: ${{ env.PACKAGE_TYPES == 'all' || env.PACKAGE_TYPES == 'homebrew' }}
ENVIRONMENT: ${{ steps.environment.outputs.ENVIRONMENT }}
release_channel: ${{ steps.release_channel.outputs.channel }}
java_version: ${{ steps.jdks.outputs.default-jdk }}
steps:
- name: Checkout hazelcast-packaging repo
uses: actions/checkout@v6
- name: Get pom.xml from ${{ inputs.VERSION }}
uses: actions/checkout@v6
with:
ref: ${{ inputs.VERSION }}
path: source_path
sparse-checkout: "**/pom.xml"
sparse-checkout-cone-mode: false
- name: Test scripts
run: |
./test_scripts.sh
- name: Set HZ_VERSION
id: hz_version_step
run: |
echo "hz_version=$(mvn help:evaluate -Dexpression=project.version --file source_path --quiet -DforceStdout --raw-streams)" >> ${GITHUB_OUTPUT}
- id: resolve-editions
uses: hazelcast/docker-actions/resolve-editions@master
with:
release-type: ${{ inputs.RELEASE_TYPE }}
- name: Calculate the environment
id: environment
run: |
ENVIRONMENT=${{ (env.EVENT_NAME == 'pull_request' && 'test') || inputs.ENVIRONMENT || 'live' }}
echo "ENVIRONMENT=${ENVIRONMENT}" >> $GITHUB_OUTPUT
- name: Get supported JDKs
id: jdks
uses: hazelcast/docker-actions/get-supported-jdks@master
with:
HZ_VERSION: ${{ steps.hz_version_step.outputs.hz_version }}
- name: Get release channel
id: release_channel
run: |
source common.sh
echo "channel=${RELEASE_CHANNEL}" >> ${GITHUB_OUTPUT}
env:
HZ_VERSION: ${{ steps.hz_version_step.outputs.hz_version }}
- name: Add workflow inputs to summary
run: |
echo "### Workflow Setup" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Name | Value |" >> $GITHUB_STEP_SUMMARY
echo "|------|-------|" >> $GITHUB_STEP_SUMMARY
echo "| HZ_VERSION | ${{ steps.hz_version_step.outputs.hz_version }} |" >> $GITHUB_STEP_SUMMARY
echo "| PACKAGE_TYPES | ${PACKAGE_TYPES} |" >> $GITHUB_STEP_SUMMARY
echo "| RELEASE_TYPE | ${RELEASE_TYPE} |" >> $GITHUB_STEP_SUMMARY
echo "| ENVIRONMENT | ${{ steps.environment.outputs.ENVIRONMENT }} |" >> $GITHUB_STEP_SUMMARY
echo "| RELEASE_CHANNEL | ${{ steps.release_channel.outputs.channel }} |" >> $GITHUB_STEP_SUMMARY
echo "| JAVA_VERSION | ${{ steps.jdks.outputs.default-jdk }} |" >> $GITHUB_STEP_SUMMARY
# Debian builds
deb-ee:
if: needs.prepare.outputs.should_build_deb == 'true' && needs.prepare.outputs.should_build_ee == 'true'
needs: prepare
uses: ./.github/workflows/publish-deb-package.yml
secrets: inherit
with:
HZ_VERSION: ${{ needs.prepare.outputs.hz_version }}
HZ_DISTRIBUTION: hazelcast-enterprise
ENVIRONMENT: ${{ needs.prepare.outputs.ENVIRONMENT }}
JAVA_VERSION: ${{ needs.prepare.outputs.java_version }}
deb-oss:
needs: prepare
if: needs.prepare.outputs.should_build_deb == 'true' && needs.prepare.outputs.should_build_oss == 'true'
uses: ./.github/workflows/publish-deb-package.yml
secrets: inherit
with:
HZ_VERSION: ${{ needs.prepare.outputs.hz_version }}
HZ_DISTRIBUTION: hazelcast
ENVIRONMENT: ${{ needs.prepare.outputs.ENVIRONMENT }}
JAVA_VERSION: ${{ needs.prepare.outputs.java_version }}
# RPM builds
rpm-ee:
if: needs.prepare.outputs.should_build_rpm == 'true' && needs.prepare.outputs.should_build_ee == 'true'
needs: prepare
uses: ./.github/workflows/publish-rpm-package.yml
secrets: inherit
with:
HZ_VERSION: ${{ needs.prepare.outputs.hz_version }}
HZ_DISTRIBUTION: hazelcast-enterprise
ENVIRONMENT: ${{ needs.prepare.outputs.ENVIRONMENT }}
JAVA_VERSION: ${{ needs.prepare.outputs.java_version }}
rpm-oss:
needs: prepare
if: needs.prepare.outputs.should_build_rpm == 'true' && needs.prepare.outputs.should_build_oss == 'true'
uses: ./.github/workflows/publish-rpm-package.yml
secrets: inherit
with:
HZ_VERSION: ${{ needs.prepare.outputs.hz_version }}
HZ_DISTRIBUTION: hazelcast
ENVIRONMENT: ${{ needs.prepare.outputs.ENVIRONMENT }}
JAVA_VERSION: ${{ needs.prepare.outputs.java_version }}
# Homebrew builds
brew-ee-package:
if: needs.prepare.outputs.should_build_homebrew == 'true' && needs.prepare.outputs.should_build_ee == 'true'
needs: prepare
uses: ./.github/workflows/publish-brew-package.yml
secrets: inherit
with:
HZ_VERSION: ${{ needs.prepare.outputs.hz_version }}
HZ_DISTRIBUTION: hazelcast-enterprise
ENVIRONMENT: ${{ needs.prepare.outputs.ENVIRONMENT }}
JAVA_VERSION: ${{ needs.prepare.outputs.java_version }}
# Only auto-promote SNAPSHOTs
brew-ee-promote:
# For SNAPSHOTs, there may not _be_ a PR to promote if there was a recent previous publish
if: needs.prepare.outputs.release_channel == 'snapshot' && needs.brew-ee-package.outputs.pull-request-operation == 'created'
needs:
- prepare
- brew-ee-package
uses: ./.github/workflows/promote-brew-package.yml
secrets: inherit
with:
HZ_VERSION: ${{ needs.prepare.outputs.hz_version }}
HZ_DISTRIBUTION: hazelcast-enterprise
ENVIRONMENT: ${{ needs.prepare.outputs.ENVIRONMENT }}
brew-oss-package:
needs: prepare
if: needs.prepare.outputs.should_build_homebrew == 'true' && needs.prepare.outputs.should_build_oss == 'true' && needs.prepare.outputs.release_channel != 'snapshot'
uses: ./.github/workflows/publish-brew-package.yml
secrets: inherit
with:
HZ_VERSION: ${{ needs.prepare.outputs.hz_version }}
HZ_DISTRIBUTION: hazelcast
ENVIRONMENT: ${{ needs.prepare.outputs.ENVIRONMENT }}
JAVA_VERSION: ${{ needs.prepare.outputs.java_version }}
# Only auto-promote SNAPSHOTs
brew-oss-promote:
# For SNAPSHOTs, there may not _be_ a PR to promote if there was a recent previous publish
if: needs.prepare.outputs.release_channel == 'snapshot' && needs.brew-oss-package.outputs.pull-request-operation == 'created'
needs:
- prepare
- brew-oss-package
uses: ./.github/workflows/promote-brew-package.yml
secrets: inherit
with:
HZ_VERSION: ${{ needs.prepare.outputs.hz_version }}
HZ_DISTRIBUTION: hazelcast
ENVIRONMENT: ${{ needs.prepare.outputs.ENVIRONMENT }}