Create Action 'Publish Docker image to GHCR'

This commit is contained in:
IgorVolochay
2025-02-15 18:28:11 +03:00
parent c88c7534e4
commit 28fb8bfd74
+35
View File
@@ -0,0 +1,35 @@
name: Publish Docker image to GHCR
on:
push:
branches:
- main
release:
types: [published]
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build Docker image
run: |
docker build -t ghcr.io/${{ github.repository_owner }}/my-image:latest .
- name: Push Docker image
run: |
docker push ghcr.io/${{ github.repository_owner }}/my-image:latest