Deploy Release Artifact #48
This file contains hidden or 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 | |
| env: | |
| REGISTRY: ghcr.io | |
| defaults: | |
| run: | |
| shell: bash | |
| permissions: | |
| contents: write | |
| packages: write | |
| pages: write | |
| id-token: write | |
| issues: write | |
| pull-requests: write | |
| jobs: | |
| prepare-release: | |
| name: Release / Prepare | |
| runs-on: solo-linux-medium | |
| outputs: | |
| version: ${{ steps.tag.outputs.version }} | |
| steps: | |
| - name: Harden the runner (Audit all outbound calls) | |
| uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2 | |
| with: | |
| egress-policy: audit | |
| - name: Checkout Code | |
| uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Node | |
| uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 | |
| with: | |
| node-version: 20 | |
| - name: Install Semantic Release | |
| run: | | |
| npm install -g [email protected] @semantic-release/[email protected] @semantic-release/[email protected] | |
| npm install -g [email protected] @commitlint/[email protected] @commitlint/[email protected] | |
| npm install -g [email protected] [email protected] [email protected] | |
| - name: Calculate Next Version | |
| env: | |
| 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-docker-image: | |
| name: Publish / Docker Image | |
| runs-on: solo-linux-medium | |
| needs: | |
| - prepare-release | |
| steps: | |
| - name: Harden the runner (Audit all outbound calls) | |
| uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2 | |
| with: | |
| egress-policy: audit | |
| - name: Checkout repository | |
| uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1 | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Docker Qemu | |
| uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1 | |
| - name: Build Docker Image (ubi8-init-dind) | |
| uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.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@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.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@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.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@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.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 }} | |
| - name: Build Docker Image (backup-uploader) | |
| uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0 | |
| with: | |
| context: docker/backup-uploader | |
| platforms: linux/amd64, linux/arm64 | |
| push: ${{ github.event.inputs.dry-run-enabled != 'true' }} | |
| tags: ghcr.io/${{ github.repository }}/backup-uploader:${{ needs.prepare-release.outputs.version }} | |
| create-github-release: | |
| name: Github / Release | |
| runs-on: solo-linux-medium | |
| needs: | |
| - publish-docker-image | |
| steps: | |
| - name: Harden the runner (Audit all outbound calls) | |
| uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2 | |
| with: | |
| egress-policy: audit | |
| - name: Checkout Code | |
| uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1 | |
| with: | |
| 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: step-security/ghaction-import-gpg@69c854a83c7f79463f8bdf46772ab09826c560cd # v6.3.1 | |
| 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 Node | |
| uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 | |
| with: | |
| node-version: 20 | |
| - name: Install Semantic Release | |
| run: | | |
| npm install -g [email protected] @semantic-release/[email protected] @semantic-release/[email protected] | |
| npm install -g [email protected] @commitlint/[email protected] @commitlint/[email protected] | |
| npm install -g [email protected] [email protected] [email protected] | |
| - name: Publish Semantic Release | |
| env: | |
| 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 |