diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index c560fa3d..02e27a03 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -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