Skip to content

Commit

Permalink
feat: allow devs to publish images from branches
Browse files Browse the repository at this point in the history
  • Loading branch information
darrenvechain committed Mar 19, 2024
1 parent e42227b commit 4daeda1
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 1 deletion.
45 changes: 45 additions & 0 deletions .github/workflows/release-ghcr-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Create ghcr.io Docker image

# Images are published manually
on:
workflow_dispatch:
inputs:
tag:
description: 'Tag for the image'
required: false
default: ${{ github.sha }}

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push-image:
runs-on: ubuntu-latest

permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

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

- name: Log in to the Container registry
uses: docker/login-action@3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@5
with:
context: .
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.event.inputs.tag }}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Log in to the Container registry
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
Expand Down

0 comments on commit 4daeda1

Please sign in to comment.