RSSingle/.github/workflows/container.yml
Dom Rodriguez 84b108e154
Fix container builds on forks by using context vars
Also add conditional to only build containers on the upstream repo.
2024-01-03 20:24:55 +00:00

45 lines
1.3 KiB
YAML

name: Container image builder for RSS single
on:
workflow_run:
workflows: ["CI workflow for RSSingle"]
types: [completed]
branches: [master]
jobs:
build-and-push-container-image:
name: Build and push container image to Docker Hub and GHCR.io
if: ${{ github.event.workflow_run.conclusion == 'success' && github.repository == 'tanrax/RSSingle' }}
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Build container image
id: build
uses: redhat-actions/buildah-build@v2
with:
image: ${{ github.repository }}
tags: latest
containerfiles: Dockerfile
- name: Push container image to Docker Hub
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build.outputs.image }}
tags: ${{ steps.build.outputs.tags }}
registry: docker.io
username: ${{ github.repository_owner }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Push container image to GHCR.io
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build.outputs.image }}
tags: ${{ steps.build.outputs.tags }}
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}