Node: Deploy Preview #114
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: "Node: Deploy Preview" | |
on: | |
workflow_dispatch: | |
inputs: | |
tag-to-deploy: | |
description: "Version/Tag to Deploy (eg: v0.41.0 or 0.41.1):" | |
type: string | |
required: true | |
dry-run-enabled: | |
description: "Perform Dry Run" | |
type: boolean | |
required: false | |
default: false | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
prepare-deploy-preview: | |
name: Prepare for Deploy | |
runs-on: [self-hosted, Linux, medium, ephemeral] | |
outputs: | |
version: ${{ steps.tag.outputs.version }} | |
prerelease: ${{ steps.tag.outputs.prerelease }} | |
steps: | |
- name: Install Semantic Version Tools | |
run: | | |
echo "::group::Download SemVer Binary" | |
sudo curl -L -o /usr/local/bin/semver https://raw.githubusercontent.com/fsaintjacques/semver-tool/master/src/semver | |
echo "::endgroup::" | |
echo "::group::Change SemVer Binary Permissions" | |
sudo chmod -v +x /usr/local/bin/semver | |
echo "::endgroup::" | |
echo "::group::Show SemVer Binary Version Info" | |
semver --version | |
echo "::endgroup::" | |
- name: Extract Tag Version | |
id: tag | |
run: | | |
RELEASE_VERSION="$(semver get release "${{ github.event.inputs.tag-to-deploy }}")" | |
PRERELEASE_VERSION="$(semver get prerel "${{ github.event.inputs.tag-to-deploy }}")" | |
FINAL_VERSION="${RELEASE_VERSION}" | |
PRERELEASE_FLAG="false" | |
[[ -n "${PRERELEASE_VERSION}" ]] && FINAL_VERSION="${RELEASE_VERSION}-${PRERELEASE_VERSION}" | |
[[ -n "${PRERELEASE_VERSION}" ]] && PRERELEASE_FLAG="true" | |
echo "version=${FINAL_VERSION}" >>"${GITHUB_OUTPUT}" | |
echo "prerelease=${PRERELEASE_FLAG}" >>"${GITHUB_OUTPUT}" | |
deploy-tag: | |
name: Deploy Tag | |
uses: ./.github/workflows/node-zxc-deploy-preview.yaml | |
needs: | |
- prepare-deploy-preview | |
with: | |
version-policy: specified | |
new-version: ${{ needs.prepare-deploy-preview.outputs.version }} | |
secrets: | |
access-token: ${{ secrets.GITHUB_TOKEN }} | |
bucket-name: ${{ secrets.RELEASE_ARTIFACT_BUCKET_NAME }} | |
jenkins-preview-url: ${{ secrets.RELEASE_JENKINS_PREVIEW_URL }} |