From cf9aaf32c07a37ac766e7461baf2ae508e33d53a Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Wed, 14 Aug 2024 09:19:52 +0200 Subject: [PATCH 1/3] GitHub: rename env variables This commit renames the environment variables to be more accurate and less confusing. --- .github/workflows/docker.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index cfa387aee..37eff68c5 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -11,8 +11,8 @@ defaults: shell: bash env: - DOCKER_REPO: lightninglabs - DOCKER_IMAGE: lightning-terminal + DOCKER_ORG: lightninglabs + DOCKER_REPO: lightning-terminal jobs: main: @@ -39,7 +39,7 @@ jobs: with: push: true platforms: linux/amd64,linux/arm64 - tags: "${{ env.DOCKER_REPO }}/${{ env.DOCKER_IMAGE }}:${{ env.RELEASE_VERSION }}" + tags: "${{ env.DOCKER_ORG }}/${{ env.DOCKER_REPO }}:${{ env.RELEASE_VERSION }}" build-args: checkout=${{ env.RELEASE_VERSION }} - name: Build and push image with /lit path @@ -48,7 +48,7 @@ jobs: with: push: true platforms: linux/amd64,linux/arm64 - tags: "${{ env.DOCKER_REPO }}/${{ env.DOCKER_IMAGE }}:${{ env.RELEASE_VERSION }}-path-prefix" + tags: "${{ env.DOCKER_ORG }}/${{ env.DOCKER_REPO }}:${{ env.RELEASE_VERSION }}-path-prefix" build-args: | checkout=${{ env.RELEASE_VERSION }} public_url=/lit From 85a89b52b71c4a0b4eef48465f7e0d99bade0e22 Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Wed, 14 Aug 2024 09:21:12 +0200 Subject: [PATCH 2/3] GitHub: split git tag and image tag This commit allows us to have different values for the git tag that is checked out (RELEASE_VERSION) and the image tag that we push (IMAGE_TAG). --- .github/workflows/docker.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 37eff68c5..54d294d83 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -30,8 +30,12 @@ jobs: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_API_KEY }} + # Make it possible to use different values for the version (used for git + # checkout) and the image tag (used for the docker image tag). - name: Set env - run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + run: | + echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + echo "IMAGE_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV - name: Build and push default image id: docker_build @@ -39,7 +43,7 @@ jobs: with: push: true platforms: linux/amd64,linux/arm64 - tags: "${{ env.DOCKER_ORG }}/${{ env.DOCKER_REPO }}:${{ env.RELEASE_VERSION }}" + tags: "${{ env.DOCKER_ORG }}/${{ env.DOCKER_REPO }}:${{ env.IMAGE_TAG }}" build-args: checkout=${{ env.RELEASE_VERSION }} - name: Build and push image with /lit path @@ -48,7 +52,7 @@ jobs: with: push: true platforms: linux/amd64,linux/arm64 - tags: "${{ env.DOCKER_ORG }}/${{ env.DOCKER_REPO }}:${{ env.RELEASE_VERSION }}-path-prefix" + tags: "${{ env.DOCKER_ORG }}/${{ env.DOCKER_REPO }}:${{ env.IMAGE_TAG }}-path-prefix" build-args: | checkout=${{ env.RELEASE_VERSION }} public_url=/lit From 2c6075328f89094ba03437ed6cae197ad7d5365b Mon Sep 17 00:00:00 2001 From: Name Date: Thu, 8 Aug 2024 13:22:15 -0700 Subject: [PATCH 3/3] GitHub: add nightly schedule to Docker CD workflow Added a daily schedule to the Docker workflow to automate builds and pushes of the `daily-testing` image. This change introduces a new cron job that runs every day at midnight (UTC) and triggers the workflow. --- .github/workflows/docker.yml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 54d294d83..e43e49fd8 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -4,7 +4,11 @@ on: push: tags: - 'v*' - + schedule: + # Every day at midnight (UTC). + - cron: '0 0 * * *' + # Manual trigger through the UI for testing. + workflow_dispatch: defaults: run: @@ -13,6 +17,11 @@ defaults: env: DOCKER_ORG: lightninglabs DOCKER_REPO: lightning-terminal + NIGHTLY_DOCKER_REPO: lightning-terminal-nightly + # TODO(guggero): Change the branch to 'master' once the experimental branch is + # merged into master. + NIGHTLY_BRANCH_NAME: 0-19-staging + NIGHTLY_TAG_NAME: experimental-daily-testing jobs: main: @@ -37,6 +46,15 @@ jobs: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV echo "IMAGE_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + # The daily/nightly build (or manual trigger) will always use the + # experimental branch and push to a different docker repo. + - name: Set daily tag + if: ${{ github.event.schedule == '0 0 * * *' || github.event_name == 'workflow_dispatch' }} + run: | + echo "RELEASE_VERSION=${{env.NIGHTLY_BRANCH_NAME}}" >> $GITHUB_ENV + echo "DOCKER_REPO=${{env.NIGHTLY_DOCKER_REPO}}" >> $GITHUB_ENV + echo "IMAGE_TAG=${{env.NIGHTLY_TAG_NAME}}-$(date -u +%Y%m%d)" >> $GITHUB_ENV + - name: Build and push default image id: docker_build uses: lightninglabs/gh-actions/build-push-action@2021.01.25.00