Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 11 additions & 69 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -1,77 +1,19 @@
name: Build and Publish Docker Image
name: Docker Release

on:
push:
branches:
- main
- master
tags:
- 'v*'
pull_request:
branches:
- main
- master
branches: [main]
tags: ["v*"]
workflow_dispatch:

env:
GHCR_REGISTRY: ghcr.io
DOCKERHUB_REGISTRY: docker.io
PRIMARY_IMAGE: luxfi/lux
ALIAS_IMAGE: luxfi/cli
concurrency:
group: docker-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false

jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
docker:
uses: luxfi/.github/.github/workflows/docker-build.yml@main
with:
image: ghcr.io/luxfi/cli

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.GHCR_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
registry: ${{ env.DOCKERHUB_REGISTRY }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASS }}

- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ env.GHCR_REGISTRY }}/${{ env.PRIMARY_IMAGE }}
${{ env.DOCKERHUB_REGISTRY }}/${{ env.PRIMARY_IMAGE }}
${{ env.GHCR_REGISTRY }}/${{ env.ALIAS_IMAGE }}
${{ env.DOCKERHUB_REGISTRY }}/${{ env.ALIAS_IMAGE }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha,prefix=sha-
type=raw,value=latest,enable={{is_default_branch}}

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64,linux/arm64
secrets: inherit
Loading