Beta workflow to set the pre_release_version at build time

This commit is contained in:
Thiago Silva 2022-08-04 17:15:19 -03:00
commit d07090388f
No known key found for this signature in database
GPG key ID: 034303EB8F453169
4 changed files with 30 additions and 10 deletions

View file

@ -22,6 +22,7 @@ jobs:
runs-on: ubuntu-20.04
outputs:
build_tag: ${{ steps.tag_gen.outputs.build_tag }}
build_number: ${{ steps.tag_gen.outputs.build_number }}
steps:
- uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
with:
@ -36,6 +37,7 @@ jobs:
(
source ci/actions/dev-build-tag-gen.sh
echo "::set-output name=build_tag::$build_tag"
echo "::set-output name=build_number::$build_number"
)
- name: Push the new tag
run: |
@ -56,9 +58,10 @@ jobs:
env:
BOOST_ROOT: /tmp/boost
steps:
- name: Set the tag
- name: Set the tag and the pre-release version
run: |
echo "TAG=${{ github.event.inputs.ref == '' && needs.build_auto_setup_job.outputs.build_tag || github.event.inputs.ref }}" >> $GITHUB_ENV
echo "VERSION_PRE_RELEASE=${{ github.event.inputs.ref == '' && needs.build_auto_setup_job.outputs.build_number || 'OFF' }}" >> $GITHUB_ENV
- uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
with:
submodules: "recursive"
@ -67,7 +70,7 @@ jobs:
- name: Fetch Deps
run: ci/actions/osx/install_deps.sh
- name: Build Artifact
run: CI_TAG=${TAG} ci/build-deploy.sh "/tmp/qt/lib/cmake/Qt5";
run: CI_TAG=${TAG} CI_VERSION_PRE_RELEASE=${VERSION_PRE_RELEASE} ci/build-deploy.sh "/tmp/qt/lib/cmake/Qt5";
- name: Deploy Artifact
run: ci/actions/deploy.sh
env:
@ -82,9 +85,10 @@ jobs:
runs-on: ubuntu-20.04
timeout-minutes: 90
steps:
- name: Set the tag
- name: Set the tag and the pre-release version
run: |
echo "TAG=${{ github.event.inputs.ref == '' && needs.build_auto_setup_job.outputs.build_tag || github.event.inputs.ref }}" >> $GITHUB_ENV
echo "VERSION_PRE_RELEASE=${{ github.event.inputs.ref == '' && needs.build_auto_setup_job.outputs.build_number || 'OFF' }}" >> $GITHUB_ENV
- uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
with:
submodules: "recursive"
@ -95,7 +99,7 @@ jobs:
COMPILER: gcc
run: ci/actions/linux/install_deps.sh
- name: Build Artifact
run: docker run -v ${GITHUB_WORKSPACE}:/workspace nanocurrency/nano-env:gcc /bin/bash -c "cd /workspace && BETA=1 CI_TAG=${TAG} ci/build-deploy.sh /usr/lib/x86_64-linux-gnu/cmake/Qt5"
run: docker run -v ${GITHUB_WORKSPACE}:/workspace nanocurrency/nano-env:gcc /bin/bash -c "cd /workspace && BETA=1 CI_TAG=${TAG} CI_VERSION_PRE_RELEASE=${VERSION_PRE_RELEASE} ci/build-deploy.sh /usr/lib/x86_64-linux-gnu/cmake/Qt5"
- name: Deploy Artifact
run: ci/actions/deploy.sh
env:
@ -110,9 +114,10 @@ jobs:
runs-on: ubuntu-20.04
timeout-minutes: 90
steps:
- name: Set the tag
- name: Set the tag and the pre-release version
run: |
echo "TAG=${{ github.event.inputs.ref == '' && needs.build_auto_setup_job.outputs.build_tag || github.event.inputs.ref }}" >> $GITHUB_ENV
echo "VERSION_PRE_RELEASE=${{ github.event.inputs.ref == '' && needs.build_auto_setup_job.outputs.build_number || 'OFF' }}" >> $GITHUB_ENV
- uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
with:
submodules: "recursive"
@ -123,7 +128,7 @@ jobs:
COMPILER: gcc
run: ci/actions/linux/install_deps.sh
- name: Build Docker (nanocurrency/nano-beta)
run: CI_TAG=${TAG} ci/actions/linux/docker-build.sh
run: CI_TAG=${TAG} CI_VERSION_PRE_RELEASE=${VERSION_PRE_RELEASE} ci/actions/linux/docker-build.sh
- name: Deploy Docker Hub (nanocurrency/nano-beta)
if: ${{ github.repository == 'nanocurrency/nano-node' }}
run: CI_TAG=${TAG} ci/actions/linux/docker-deploy.sh
@ -144,9 +149,10 @@ jobs:
runs-on: windows-latest
timeout-minutes: 90
steps:
- name: Set the tag
- name: Set the tag and the pre-release version
run: |
Write-Output "TAG=${{ github.event.inputs.ref == '' && needs.build_auto_setup_job.outputs.build_tag || github.event.inputs.ref }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
Write-Output "VERSION_PRE_RELEASE=${{ github.event.inputs.ref == '' && needs.build_auto_setup_job.outputs.build_number || 'OFF' }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
with:
submodules: "recursive"

View file

@ -32,9 +32,14 @@ fi
docker_build()
{
ci_version_pre_release="OFF"
if [[ -n "${CI_VERSION_PRE_RELEASE}" ]]; then
ci_version_pre_release="$CI_VERSION_PRE_RELEASE"
fi
if [[ "$GITHUB_WORKFLOW" != "Develop" ]]; then
ghcr_image_name="ghcr.io/${GITHUB_REPOSITORY}/nano${network_tag_suffix}"
"$scripts"/build-docker-image.sh docker/node/Dockerfile "$docker_image_name" --build-arg NETWORK="$network" --build-arg CI_BUILD=true --build-arg CI_TAG="$CI_TAG"
"$scripts"/build-docker-image.sh docker/node/Dockerfile "$docker_image_name" --build-arg NETWORK="$network" --build-arg CI_BUILD=true --build-arg CI_VERSION_PRE_RELEASE="$ci_version_pre_release" --build-arg CI_TAG="$CI_TAG"
for tag in "${tags[@]}"; do
# Sanitize docker tag
# https://docs.docker.com/engine/reference/commandline/tag/

View file

@ -15,8 +15,12 @@ if (${env:artifact} -eq 1) {
$env:NANO_SHARED_BOOST = "ON"
$env:NANO_TEST = "-DNANO_TEST=OFF"
$env:CI_TAG = ${env:TAG}
$env:CI = "-DCI_BUILD=ON"
if ([string]::IsNullOrEmpty(${env:VERSION_PRE_RELEASE})) {
$env:CI_VERSION_PRE_RELEASE = "OFF"
} else {
$env:CI_VERSION_PRE_RELEASE = ${env:VERSION_PRE_RELEASE}
}
$env:CI = "-DCI_BUILD=ON -DCI_VERSION_PRE_RELEASE=${env:CI_VERSION_PRE_RELEASE}"
$env:RUN = "artifact"
}
else {

View file

@ -1,6 +1,10 @@
#!/bin/bash
qt_dir=${1}
ci_version_pre_release="OFF"
if [[ -n "${CI_VERSION_PRE_RELEASE}" ]]; then
ci_version_pre_release="$CI_VERSION_PRE_RELEASE"
fi
set -o errexit
set -o nounset
@ -32,6 +36,7 @@ cmake \
-DNANO_SHARED_BOOST=ON \
-DQt5_DIR=${qt_dir} \
-DCI_BUILD=true \
-DCI_VERSION_PRE_RELEASE="${ci_version_pre_release}" \
..
if [[ "$OS" == 'Linux' ]]; then