Initial commit #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: ci | |
on: | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
push: | |
pull_request: | |
branches: | |
- master | |
env: | |
DEBIAN_FRONTEND: noninteractive | |
REGISTRY: quay.io | |
REGISTRY_USER: kerryeon | |
REGISTRY_REPOSITORY: ulagbulag | |
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }} | |
IMAGE_NAME: openark | |
IMAGE_REPO: docker.io/library/debian | |
IMAGE_VERSION: latest | |
jobs: | |
build-container-image: | |
if: ${{ github.ref == 'refs/heads/master' }} | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: > | |
sudo apt-get update | |
&& sudo apt-get install -y podman | |
&& mkdir -p /home/runner/.docker/ | |
&& echo '{"auths":{"quay.io":{}}}' >/home/runner/.docker/config.json | |
# TODO: Wait a buildah issue to be resolved: https://github.com/redhat-actions/buildah-build/issues/116 | |
- name: Disable container build cache | |
run: find ./ -name 'Dockerfile*' -exec sed -i '/--mount=type=cache[a-z0-9,=\/-]* \\$/ d' '{}' \; | |
- name: Log in to ${{ env.REGISTRY }} | |
uses: redhat-actions/podman-login@v1 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ env.REGISTRY_USER }} | |
password: ${{ env.REGISTRY_PASSWORD }} | |
- name: Build Image | |
id: build-and-push-image | |
uses: redhat-actions/buildah-build@v2 | |
with: | |
image: ${{ env.IMAGE_NAME }} | |
tags: latest | |
context: "." | |
containerfiles: | | |
./Dockerfile | |
build-args: | | |
IMAGE_REPO=${{ env.IMAGE_REPO }} | |
IMAGE_VERSION=${{ env.IMAGE_VERSION }} | |
- name: Push To ${{ env.REGISTRY }} | |
id: push-to-quay | |
if: ${{ github.repository }} == ${{ env.REGISTRY_REPOSITORY }}/${{ env.IMAGE_NAME }} | |
uses: redhat-actions/push-to-registry@v2 | |
with: | |
image: ${{ steps.build-and-push-image.outputs.image }} | |
tags: ${{ steps.build-and-push-image.outputs.tags }} | |
registry: ${{ env.REGISTRY }}/${{ env.REGISTRY_REPOSITORY }} | |
- name: Print image url | |
run: echo "Image pushed to ${{ steps.push-to-quay.outputs.registry-paths }}" |