Update Docker Image workflow
This commit is contained in:
parent
d8c76046d8
commit
6db56a93da
22
.github/workflows/docker-image.yml
vendored
22
.github/workflows/docker-image.yml
vendored
@ -2,7 +2,9 @@ name: Docker Image CI
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ "main" ]
|
branches: ['main']
|
||||||
|
pull_request:
|
||||||
|
branches: ['main']
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
@ -13,22 +15,28 @@ jobs:
|
|||||||
packages: write
|
packages: write
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- uses: docker/login-action@v2.2.0
|
- name: Login to GitHub Container Registry
|
||||||
|
if: github.event_name != 'pull_request'
|
||||||
|
uses: docker/login-action@v2
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
username: ${{github.actor}}
|
username: ${{github.actor}}
|
||||||
password: ${{secrets.GITHUB_TOKEN}}
|
password: ${{secrets.GITHUB_TOKEN}}
|
||||||
|
|
||||||
- uses: docker/metadata-action@v4.6.0
|
- name: Extract metadata
|
||||||
|
uses: docker/metadata-action@v4
|
||||||
id: meta
|
id: meta
|
||||||
with:
|
with:
|
||||||
images: ghcr.io/groceries
|
images: ghcr.io/jamsch0/groceries
|
||||||
|
tags: type=raw,value=latest,enable={{is_default_branch}}
|
||||||
|
|
||||||
- uses: docker/build-push-action@v4.1.1
|
- name: Build and push
|
||||||
|
uses: docker/build-push-action@v4
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
push: true
|
push: ${{github.event_name != 'pull_request'}}
|
||||||
tags: ${{steps.meta.outputs.tags}}
|
tags: ${{steps.meta.outputs.tags}}
|
||||||
labels: ${{steps.meta.outputs.labels}}
|
labels: ${{steps.meta.outputs.labels}}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user