Skip to content

Commit

Permalink
ci: publish img to github registry
Browse files Browse the repository at this point in the history
Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>
  • Loading branch information
maiqueb committed May 9, 2024
1 parent 20393ad commit a579102
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/publish-img.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Push container image
on:
push:
branches:
- main
pull_request:
branches: [ "main" ]

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

jobs:
push-amd64:
name: Image push/amd64
runs-on: ubuntu-latest

permissions:
contents: read
packages: write
attestations: write
id-token: write

steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v3

- name: Version Check
run: |
echo "git_commit_hash=$(git describe --no-match --always --abbrev=8 --dirty)" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3.0.0

- name: Login to Container Registry
if: github.repository_owner == 'maiqueb'
uses: docker/login-action@v3.0.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Push container image
if: github.repository_owner == 'maiqueb'
uses: docker/build-push-action@v5.3.0
with:
context: .
push: true
tags: ghcr.io/${{ github.repository }}:${{ env.git_commit_hash }}
file: Dockerfile

0 comments on commit a579102

Please sign in to comment.