Skip to content

Commit 303312c

Browse files
authored
Merge pull request #813 from dstadulis/cd-nightly-docker-builds
Add nightly schedule to Docker CD workflow
2 parents 272409d + 2c60753 commit 303312c

File tree

1 file changed

+28
-6
lines changed

1 file changed

+28
-6
lines changed

.github/workflows/docker.yml

+28-6
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,24 @@ on:
44
push:
55
tags:
66
- 'v*'
7-
7+
schedule:
8+
# Every day at midnight (UTC).
9+
- cron: '0 0 * * *'
10+
# Manual trigger through the UI for testing.
11+
workflow_dispatch:
812

913
defaults:
1014
run:
1115
shell: bash
1216

1317
env:
14-
DOCKER_REPO: lightninglabs
15-
DOCKER_IMAGE: lightning-terminal
18+
DOCKER_ORG: lightninglabs
19+
DOCKER_REPO: lightning-terminal
20+
NIGHTLY_DOCKER_REPO: lightning-terminal-nightly
21+
# TODO(guggero): Change the branch to 'master' once the experimental branch is
22+
# merged into master.
23+
NIGHTLY_BRANCH_NAME: 0-19-staging
24+
NIGHTLY_TAG_NAME: experimental-daily-testing
1625

1726
jobs:
1827
main:
@@ -30,16 +39,29 @@ jobs:
3039
username: ${{ secrets.DOCKER_USERNAME }}
3140
password: ${{ secrets.DOCKER_API_KEY }}
3241

42+
# Make it possible to use different values for the version (used for git
43+
# checkout) and the image tag (used for the docker image tag).
3344
- name: Set env
34-
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
45+
run: |
46+
echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
47+
echo "IMAGE_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
48+
49+
# The daily/nightly build (or manual trigger) will always use the
50+
# experimental branch and push to a different docker repo.
51+
- name: Set daily tag
52+
if: ${{ github.event.schedule == '0 0 * * *' || github.event_name == 'workflow_dispatch' }}
53+
run: |
54+
echo "RELEASE_VERSION=${{env.NIGHTLY_BRANCH_NAME}}" >> $GITHUB_ENV
55+
echo "DOCKER_REPO=${{env.NIGHTLY_DOCKER_REPO}}" >> $GITHUB_ENV
56+
echo "IMAGE_TAG=${{env.NIGHTLY_TAG_NAME}}-$(date -u +%Y%m%d)" >> $GITHUB_ENV
3557
3658
- name: Build and push default image
3759
id: docker_build
3860
uses: lightninglabs/gh-actions/[email protected]
3961
with:
4062
push: true
4163
platforms: linux/amd64,linux/arm64
42-
tags: "${{ env.DOCKER_REPO }}/${{ env.DOCKER_IMAGE }}:${{ env.RELEASE_VERSION }}"
64+
tags: "${{ env.DOCKER_ORG }}/${{ env.DOCKER_REPO }}:${{ env.IMAGE_TAG }}"
4365
build-args: checkout=${{ env.RELEASE_VERSION }}
4466

4567
- name: Build and push image with /lit path
@@ -48,7 +70,7 @@ jobs:
4870
with:
4971
push: true
5072
platforms: linux/amd64,linux/arm64
51-
tags: "${{ env.DOCKER_REPO }}/${{ env.DOCKER_IMAGE }}:${{ env.RELEASE_VERSION }}-path-prefix"
73+
tags: "${{ env.DOCKER_ORG }}/${{ env.DOCKER_REPO }}:${{ env.IMAGE_TAG }}-path-prefix"
5274
build-args: |
5375
checkout=${{ env.RELEASE_VERSION }}
5476
public_url=/lit

0 commit comments

Comments
 (0)