mirror of
https://github.com/lightninglabs/lightning-terminal.git
synced 2026-08-17 13:07:41 +02:00
To fix the issue that currently prevents the second image (with the /lit path prefix) to be built and pushed (both for releases and nightly builds), we clear the build cache between builds.
82 lines
2.8 KiB
YAML
82 lines
2.8 KiB
YAML
name: Docker image build
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
schedule:
|
|
# Every day at midnight (UTC).
|
|
- cron: '0 0 * * *'
|
|
# Manual trigger through the UI for testing.
|
|
workflow_dispatch:
|
|
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
|
|
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:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Set up QEMU
|
|
uses: lightninglabs/gh-actions/setup-qemu-action@2021.01.25.00
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: lightninglabs/gh-actions/setup-buildx-action@2021.01.25.00
|
|
|
|
- name: Login to DockerHub
|
|
uses: lightninglabs/gh-actions/login-action@2021.01.25.00
|
|
with:
|
|
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
|
|
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
|
|
with:
|
|
push: true
|
|
platforms: linux/amd64,linux/arm64
|
|
tags: "${{ env.DOCKER_ORG }}/${{ env.DOCKER_REPO }}:${{ env.IMAGE_TAG }}"
|
|
build-args: checkout=${{ env.RELEASE_VERSION }}
|
|
|
|
- name: Clear the build cache
|
|
run: docker builder prune -a -f
|
|
|
|
- name: Build and push image with /lit path
|
|
id: docker_build2
|
|
uses: lightninglabs/gh-actions/build-push-action@2021.01.25.00
|
|
with:
|
|
push: true
|
|
platforms: linux/amd64,linux/arm64
|
|
tags: "${{ env.DOCKER_ORG }}/${{ env.DOCKER_REPO }}:${{ env.IMAGE_TAG }}-path-prefix"
|
|
build-args: |
|
|
checkout=${{ env.RELEASE_VERSION }}
|
|
public_url=/lit
|
|
|
|
- name: Image digest
|
|
run: echo ${{ steps.docker_build.outputs.digest }} ${{ steps.docker_build2.outputs.digest }}
|