Deploy Release Artifact #109
Workflow file for this run
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
## | |
# Copyright (C) 2023-2024 Hedera Hashgraph, LLC | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
## | |
name: "Deploy Release Artifact" | |
on: | |
workflow_dispatch: | |
inputs: | |
dry-run-enabled: | |
description: "Perform Dry Run" | |
type: boolean | |
required: false | |
default: false | |
java-distribution: | |
description: "Java JDK Distribution:" | |
type: string | |
required: false | |
default: "temurin" | |
java-version: | |
description: "Java JDK Version:" | |
type: string | |
required: false | |
default: "21.0.1" | |
gradle-version: | |
description: "Gradle Version:" | |
type: string | |
required: false | |
default: "wrapper" | |
env: | |
REGISTRY: ghcr.io | |
GRADLE_CACHE_USERNAME: ${{ secrets.GRADLE_CACHE_USERNAME }} | |
GRADLE_CACHE_PASSWORD: ${{ secrets.GRADLE_CACHE_PASSWORD }} | |
defaults: | |
run: | |
shell: bash | |
permissions: | |
contents: write | |
packages: write | |
pages: write | |
id-token: write | |
jobs: | |
prepare-release: | |
name: Release / Prepare | |
runs-on: [self-hosted, Linux, medium, ephemeral] | |
outputs: | |
version: ${{ steps.tag.outputs.version }} | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
with: | |
fetch-depth: 0 | |
- name: Setup Node | |
uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 | |
with: | |
node-version: 18 | |
- name: Install Semantic Release | |
run: | | |
npm install -g semantic-release@21.0.7 @semantic-release/git@10.0.1 @semantic-release/exec@6.0.3 gradle-semantic-release-plugin@1.7.6 | |
npm install -g conventional-changelog-conventionalcommits@6.1.0 @commitlint/cli@17.6.6 @commitlint/config-conventional@17.6.6 | |
npm install -g marked-mangle@1.0.1 marked-gfm-heading-id@3.0.4 semantic-release-conventional-commits@3.0.0 | |
- name: Calculate Next Version | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GIT_AUTHOR_NAME: ${{ secrets.GIT_USER_NAME }} | |
GIT_AUTHOR_EMAIL: ${{ secrets.GIT_USER_EMAIL }} | |
GIT_COMMITTER_NAME: ${{ secrets.GIT_USER_NAME }} | |
GIT_COMMITTER_EMAIL: ${{ secrets.GIT_USER_EMAIL }} | |
run: npx semantic-release --dry-run | |
- name: Extract Version | |
id: tag | |
run: | | |
[[ "${{ github.event.inputs.dry-run-enabled }}" == true && ! -f VERSION ]] && echo -n "0.0.0-latest" > VERSION | |
echo "version=$(cat VERSION | tr -d '[:space:]')" >> ${GITHUB_OUTPUT} | |
publish-maven-central: | |
name: Publish | |
uses: ./.github/workflows/zxc-release-maven-central.yaml | |
needs: | |
- prepare-release | |
# TODO: Remove the if condition before merging | |
if: ${{ github.event.inputs.dry-run-enabled != 'true' && !cancelled() && !failure() }} | |
with: | |
custom-job-label: Maven Central | |
new-version: ${{ needs.prepare-release.outputs.version }} | |
dry-run-enabled: ${{ github.event.inputs.dry-run-enabled == 'true' }} | |
java-distribution: ${{ github.event.inputs.java-distribution || 'temurin' }} | |
java-version: ${{ github.event.inputs.java-version || '21.0.1' }} | |
gradle-version: ${{ github.event.inputs.gradle-version || 'wrapper' }} | |
secrets: | |
gradle-cache-username: ${{ secrets.GRADLE_CACHE_USERNAME }} | |
gradle-cache-password: ${{ secrets.GRADLE_CACHE_PASSWORD }} | |
gpg-key-contents: ${{ secrets.GPG_KEY_CONTENTS }} | |
gpg-key-passphrase: ${{ secrets.GPG_KEY_PASSPHRASE }} | |
git-user-name: ${{ secrets.GIT_USER_NAME }} | |
git-user-email: ${{ secrets.GIT_USER_EMAIL }} | |
ossrh-user-name: ${{ secrets.OSSRH_USER_NAME }} | |
ossrh-user-password: ${{ secrets.OSSRH_USER_PASSWORD }} | |
publish-docker-image: | |
name: Publish / Docker Image | |
runs-on: [self-hosted, Linux, medium, ephemeral] | |
needs: | |
- prepare-release | |
# TODO: Remove the if condition before merging | |
if: ${{ github.event.inputs.dry-run-enabled != 'true' && !cancelled() && !failure() }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up Docker Qemu | |
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0 | |
- name: Build Docker Image (ubi8-init-dind) | |
uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 # v5.1.0 | |
with: | |
context: docker/ubi8-init-dind | |
platforms: linux/amd64, linux/arm64 | |
push: ${{ github.event.inputs.dry-run-enabled != 'true' }} | |
tags: ghcr.io/${{ github.repository }}/ubi8-init-dind:${{ needs.prepare-release.outputs.version }} | |
- name: Build Docker Image (ubi8-init-java17) | |
uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 # v5.1.0 | |
with: | |
context: docker/ubi8-init-java17 | |
platforms: linux/amd64, linux/arm64 | |
push: ${{ github.event.inputs.dry-run-enabled != 'true' }} | |
tags: ghcr.io/${{ github.repository }}/ubi8-init-java17:${{ needs.prepare-release.outputs.version }} | |
- name: Build Docker Image (ubi8-init-java21) | |
uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 # v5.1.0 | |
with: | |
context: docker/ubi8-init-java21 | |
platforms: linux/amd64, linux/arm64 | |
push: ${{ github.event.inputs.dry-run-enabled != 'true' }} | |
tags: ghcr.io/${{ github.repository }}/ubi8-init-java21:${{ needs.prepare-release.outputs.version }} | |
- name: Build Docker Image (kubectl-bats) | |
uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 # v5.1.0 | |
with: | |
context: docker/kubectl-bats | |
platforms: linux/amd64, linux/arm64 | |
push: ${{ github.event.inputs.dry-run-enabled != 'true' }} | |
tags: ghcr.io/${{ github.repository }}/kubectl-bats:${{ needs.prepare-release.outputs.version }} | |
publish-helm-charts: | |
name: Publish / Helm Charts | |
runs-on: [self-hosted, Linux, medium, ephemeral] | |
needs: | |
- prepare-release | |
# TODO: Remove the if condition before merging | |
if: ${{ github.event.inputs.dry-run-enabled != 'true' && !cancelled() && !failure() }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Setup Helm | |
uses: azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3.5 | |
with: | |
version: "v3.12.3" # helm version | |
- name: Setup Java | |
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4.0.0 | |
with: | |
distribution: ${{ github.event.inputs.java-distribution || 'temurin' }} | |
java-version: ${{ github.event.inputs.java-version || '21.0.1' }} | |
- name: Setup Gradle | |
uses: gradle/gradle-build-action@a8f75513eafdebd8141bd1cd4e30fcd194af8dfa # v2.12.0 | |
with: | |
gradle-version: ${{ github.event.inputs.gradle-version || 'wrapper' }} | |
- name: Apply Version Number Update (Explicit) | |
uses: gradle/gradle-build-action@a8f75513eafdebd8141bd1cd4e30fcd194af8dfa # v2.12.0 | |
with: | |
gradle-version: ${{ github.event.inputs.gradle-version || 'wrapper' }} | |
arguments: versionAsSpecified --scan -PnewVersion=${{ needs.prepare-release.outputs.version }} | |
- name: Publish Helm Charts | |
uses: stefanprodan/helm-gh-pages@0ad2bb377311d61ac04ad9eb6f252fb68e207260 #v1.7.0 | |
if: ${{ github.event.inputs.dry-run-enabled != 'true' && !cancelled() && !failure() }} | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
target_dir: charts | |
create-github-release: | |
name: Github / Release | |
runs-on: [self-hosted, Linux, medium, ephemeral] | |
needs: | |
# TODO: Remove the prepare-release needs before merging | |
- prepare-release | |
# TODO: Uncomment the following lines before merging | |
#- publish-maven-central | |
#- publish-docker-image | |
#- publish-helm-charts | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
with: | |
token: ${{ secrets.GH_ACCESS_TOKEN }} | |
fetch-depth: 0 | |
- name: Install GnuPG Tools | |
run: | | |
if ! command -v gpg2 >/dev/null 2>&1; then | |
echo "::group::Updating APT Repository Indices" | |
sudo apt update | |
echo "::endgroup::" | |
echo "::group::Installing GnuPG Tools" | |
sudo apt install -y gnupg2 | |
echo "::endgroup::" | |
fi | |
- name: Import GPG key | |
id: gpg_key | |
uses: crazy-max/ghaction-import-gpg@82a020f1f7f605c65dd2449b392a52c3fcfef7ef # v6.0.0 | |
with: | |
gpg_private_key: ${{ secrets.GPG_KEY_CONTENTS }} | |
passphrase: ${{ secrets.GPG_KEY_PASSPHRASE }} | |
git_config_global: true | |
git_user_signingkey: true | |
git_commit_gpgsign: true | |
git_tag_gpgsign: false | |
- name: Setup Java | |
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4.0.0 | |
with: | |
distribution: ${{ inputs.java-distribution }} | |
java-version: ${{ inputs.java-version }} | |
- name: Setup Gradle | |
uses: gradle/gradle-build-action@a8f75513eafdebd8141bd1cd4e30fcd194af8dfa # v2.12.0 | |
with: | |
gradle-version: ${{ github.event.inputs.gradle-version || 'wrapper' }} | |
- name: Setup Node | |
uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 | |
with: | |
node-version: 18 | |
- name: Setup JFrog CLI | |
uses: jfrog/setup-jfrog-cli@8fc3d0018a8721b9a797cd7fd97c8e4833f5a3d1 # v3.5.3 | |
env: | |
JF_URL: ${{ vars.JF_URL }} | |
JF_ACCESS_TOKEN: ${{ secrets.JF_ACCESS_TOKEN }} | |
- name: Verify JFrog Connectivity | |
run: jfrog rt ping | |
- name: Setup JFrog NPM Repository | |
working-directory: solo | |
run: jf npmc --server-id-resolve setup-jfrog-cli-server --server-id-deploy setup-jfrog-cli-server --repo-resolve solo-npm-release --repo-deploy solo-npm-release | |
- name: Install Semantic Release | |
run: | | |
npm install -g semantic-release@21.0.7 @semantic-release/git@10.0.1 @semantic-release/exec@6.0.3 gradle-semantic-release-plugin@1.7.6 | |
npm install -g conventional-changelog-conventionalcommits@6.1.0 @commitlint/cli@17.6.6 @commitlint/config-conventional@17.6.6 | |
npm install -g marked-mangle@1.0.1 marked-gfm-heading-id@3.0.4 semantic-release-conventional-commits@3.0.0 | |
- name: Install Dependencies | |
working-directory: solo | |
run: jf npm ci | |
- name: Deploy to JFrog Registry | |
working-directory: solo | |
if: ${{ github.event.inputs.dry-run-enabled != 'true' && !cancelled() && !failure() }} | |
run: jf npm publish | |
- name: Setup NPM Authentication | |
working-directory: solo | |
run: | | |
# create .npmrc file to publish solo to Github NPM registry | |
rm -f .npmrc || true | |
echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}' > ".npmrc" | |
echo '@hashgraph:registry=https://registry.npmjs.org/' >> ".npmrc" | |
- name: Publish Semantic Release | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }} | |
GIT_AUTHOR_NAME: ${{ secrets.GIT_USER_NAME }} | |
GIT_AUTHOR_EMAIL: ${{ secrets.GIT_USER_EMAIL }} | |
GIT_COMMITTER_NAME: ${{ secrets.GIT_USER_NAME }} | |
GIT_COMMITTER_EMAIL: ${{ secrets.GIT_USER_EMAIL }} | |
if: ${{ github.event.inputs.dry-run-enabled != 'true' && !cancelled() && !failure() }} | |
run: npx semantic-release |