Skip to content

Commit

Permalink
update gha worklflow
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanotorresi committed Dec 16, 2024
1 parent ff2399e commit 27f821d
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
name: Build & push container image to GH packages
on:
push:
tags-ignore:
- "*"
branches:
- "main"
tags:
- "**"
pull_request:
release:
types: [published]
workflow_dispatch:

env:
Expand All @@ -17,32 +15,32 @@ env:
jobs:
build-and-push-image:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' || github.event_name == 'release'
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

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

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
uses: docker/build-push-action@v6
with:
context: .
push: true
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

0 comments on commit 27f821d

Please sign in to comment.