.github/workflows/web-container.yml
name: container
on:
workflow_dispatch:
push:
paths:
- 'web/**'
branches:
- 'master'
tags:
- 'v*'
pull_request:
paths:
- 'web/**'
branches:
- 'master'
env:
REGISTRY_USER: ${{ github.actor }}
REGISTRY_PASSWORD: ${{ github.token }}
IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }}
jobs:
build-and-push-image:
defaults:
run:
working-directory: web
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Docker meta
id: docker-metadata
uses: docker/metadata-action@v4
with:
images: ghcr.io/${{ github.actor }}/penny
- name: Build Image
id: build-image
uses: redhat-actions/buildah-build@v2
with:
image: penny
tags: ${{ steps.docker-metadata.outputs.tags }}
labels: ${{ steps.docker-metadata.outputs.labels }}
context: web
containerfiles: |
./web/Containerfile
extra-args: |
--pull
- name: Log in to the Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push to Container Registry
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build-image.outputs.image }}
tags: ${{ steps.build-image.outputs.tags }}
registry: ghcr.io/${{ github.actor }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}