Skip to content

Commit

Permalink
ci: update docker release
Browse files Browse the repository at this point in the history
CI runs only on tags push
  • Loading branch information
matteo-cristino authored and jaromil committed Sep 23, 2024
1 parent 171026f commit eece661
Showing 1 changed file with 5 additions and 56 deletions.
61 changes: 5 additions & 56 deletions .github/workflows/publish-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,63 +2,12 @@ name: Create and publish a Docker image

on:
push:
branches:
- 'master'
tags:
- 'v*'
pull_request:
branches:
- 'master'

env:
REGISTRY: ghcr.io
IMAGE_NAME: dyne/zenroom

jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3
with:
images: |
${{ env.IMAGE_NAME }}
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=edge
type=sha
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
labels: |
org.opencontainers.image.vendor=Dyne.org
- name: Log in Docker Hub
uses: docker/login-action@v1
if: github.event_name != 'pull_request'
with:
username: dyne
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Log in to the Container registry
uses: docker/login-action@v1
if: github.event_name != 'pull_request'
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v2
if: github.event_name != 'pull_request'
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
publish_docker_image:
name: 🐳 Publish Docker image
needs: semantic-release
uses: ForkbombEu/workflows/.github/workflows/publish-ghcr.yml@main
secrets: inherit

0 comments on commit eece661

Please sign in to comment.