another try?

This commit is contained in:
2023-09-22 11:20:21 +02:00
parent 4245335df6
commit 1bc1fa9d4a

View File

@@ -1,38 +1,18 @@
#
name: build-push-docker-image
on:
push:
branches: ['development']
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
name: publish
on: [push]
jobs:
build-and-push-image:
publish-ephemeruo-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v1
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@v1
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- uses: actions/checkout@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: build-push-image
run: |
docker build . --tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
docker run ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest