From 2f672c670b3efdeb45ae510ba52237278a4e9acc Mon Sep 17 00:00:00 2001 From: gr0vity-dev Date: Thu, 21 Mar 2024 13:58:38 +0100 Subject: [PATCH 1/4] simplify DOCKER_PASSWORD conditional check --- .github/workflows/build_deploy.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_deploy.yml b/.github/workflows/build_deploy.yml index b9a25f868d..cfedfa5c55 100644 --- a/.github/workflows/build_deploy.yml +++ b/.github/workflows/build_deploy.yml @@ -155,6 +155,8 @@ jobs: strategy: matrix: network: ["TEST", "BETA", "LIVE"] + env: + DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} steps: - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0 with: @@ -167,10 +169,8 @@ jobs: NETWORK: ${{ matrix.network }} CI_TAG: ${{ needs.prepare_build.outputs.ci_tag }} DOCKER_REGISTRY: ${{ vars.DOCKER_REGISTRY }} - - name: Check if secrets.DOCKER_PASSWORD exists - run: echo "DOCKER_PASSWORD_EXISTS=${{ secrets.DOCKER_PASSWORD != '' }}" >> $GITHUB_ENV - name: Deploy Docker Hub - if: env.DOCKER_PASSWORD_EXISTS == 'true' + if: env.DOCKER_PASSWORD != '' run: ci/actions/linux/docker-deploy.sh env: CI_TAG: ${{ needs.prepare_build.outputs.ci_tag }} From 645be8412b6cb8e08811fba084df917a90fae43c Mon Sep 17 00:00:00 2001 From: gr0vity-dev Date: Thu, 21 Mar 2024 13:59:53 +0100 Subject: [PATCH 2/4] move env variable declaration to job level --- .github/workflows/build_deploy.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build_deploy.yml b/.github/workflows/build_deploy.yml index cfedfa5c55..c55fd407a6 100644 --- a/.github/workflows/build_deploy.yml +++ b/.github/workflows/build_deploy.yml @@ -156,6 +156,9 @@ jobs: matrix: network: ["TEST", "BETA", "LIVE"] env: + CI_TAG: ${{ needs.prepare_build.outputs.ci_tag }} + DOCKER_REGISTRY: ${{ vars.DOCKER_REGISTRY }} + DOCKER_USER: ${{ vars.DOCKER_USER }} DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} steps: - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0 @@ -167,21 +170,15 @@ jobs: run: ci/actions/linux/docker-build.sh env: NETWORK: ${{ matrix.network }} - CI_TAG: ${{ needs.prepare_build.outputs.ci_tag }} - DOCKER_REGISTRY: ${{ vars.DOCKER_REGISTRY }} - name: Deploy Docker Hub if: env.DOCKER_PASSWORD != '' run: ci/actions/linux/docker-deploy.sh env: - CI_TAG: ${{ needs.prepare_build.outputs.ci_tag }} NETWORK: ${{ matrix.network }} - DOCKER_REGISTRY: ${{ vars.DOCKER_REGISTRY }} - DOCKER_USER: ${{ vars.DOCKER_USER }} DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} - name: Deploy Docker (ghcr.io) run: ci/actions/linux/ghcr-deploy.sh env: - CI_TAG: ${{ needs.prepare_build.outputs.ci_tag }} NETWORK: ${{ matrix.network }} DOCKER_REGISTRY: ghcr.io DOCKER_USER: ${{ github.repository_owner }} From 334a9de57f7ef7b4d3534ed7c9fb1381bced3544 Mon Sep 17 00:00:00 2001 From: gr0vity-dev Date: Thu, 21 Mar 2024 14:05:11 +0100 Subject: [PATCH 3/4] feat: introduce nano-nightly dockerhub registry for live network - all non release builds for the live network are pushed to nano-nightly - only release builds will be pushed to nanocurrency/nano dockerhub registry --- .github/workflows/build_deploy.yml | 1 + ci/actions/linux/docker-impl/docker-common.sh | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_deploy.yml b/.github/workflows/build_deploy.yml index c55fd407a6..49c9a884ec 100644 --- a/.github/workflows/build_deploy.yml +++ b/.github/workflows/build_deploy.yml @@ -160,6 +160,7 @@ jobs: DOCKER_REGISTRY: ${{ vars.DOCKER_REGISTRY }} DOCKER_USER: ${{ vars.DOCKER_USER }} DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} + IS_RELEASE_BUILD: ${{ github.event.inputs.is_release_build || 'false' }} steps: - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0 with: diff --git a/ci/actions/linux/docker-impl/docker-common.sh b/ci/actions/linux/docker-impl/docker-common.sh index bcda39fbbd..02d9a8cc7e 100755 --- a/ci/actions/linux/docker-impl/docker-common.sh +++ b/ci/actions/linux/docker-impl/docker-common.sh @@ -18,7 +18,13 @@ fi if [[ "$NETWORK" = "LIVE" ]]; then echo "Live" - network_tag_suffix='' + if [[ "$IS_RELEASE_BUILD" = "true" ]]; then + network_tag_suffix='' + docker_image_name="${DOCKER_REGISTRY}/nano" + else + network_tag_suffix='-nightly' + docker_image_name="${DOCKER_REGISTRY}/nano-nightly" + fi network="live" elif [[ "$NETWORK" = "BETA" ]]; then echo "Beta" From b7c3a78de40c47aeeb85c4ab5a0559c292fcba9c Mon Sep 17 00:00:00 2001 From: gr0vity-dev Date: Thu, 21 Mar 2024 16:53:15 +0100 Subject: [PATCH 4/4] avoid setting `docker_image_name` twice --- ci/actions/linux/docker-impl/docker-common.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/ci/actions/linux/docker-impl/docker-common.sh b/ci/actions/linux/docker-impl/docker-common.sh index 02d9a8cc7e..912558b12c 100755 --- a/ci/actions/linux/docker-impl/docker-common.sh +++ b/ci/actions/linux/docker-impl/docker-common.sh @@ -20,10 +20,8 @@ if [[ "$NETWORK" = "LIVE" ]]; then echo "Live" if [[ "$IS_RELEASE_BUILD" = "true" ]]; then network_tag_suffix='' - docker_image_name="${DOCKER_REGISTRY}/nano" else network_tag_suffix='-nightly' - docker_image_name="${DOCKER_REGISTRY}/nano-nightly" fi network="live" elif [[ "$NETWORK" = "BETA" ]]; then