Skip to content

added test on push

added test on push #1

Workflow file for this run

name: Container build
"on":
release:
types:
- published
push:
jobs:
build:
name: Build container
runs-on: ubuntu-22.04
strategy:
matrix:
py-base-image:
- pypy:3.10-slim
- python:3.10-slim
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Process base image
id: base-image
run: |
PY_VERSION=$(./run.sh extract-version "${{ matrix.py-base-image }}")
echo "::set-output name=py-version::$PY_VERSION"
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ github.repository }}/${{ steps.base-image.outputs.py-version }}
tags: |
type=ref,event=tag
type=ref,event=branch
# git short commit
type=sha
- name: Build
uses: docker/build-push-action@v4
with:
context: .
load: true
build-args: |
BASE_IMAGE=${{ matrix.py-base-image }}
tags: app:latest
- name: Test
run: |
docker run --rm -it app:latest ansible --version
- name: Login to GitHub Container Registry
if: github.event_name == 'release'
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Process ansible core version
if: github.event_name == 'release'
id: ansible-core-version
run: |
TAG_NAME=${{ github.event.release.tag_name }}
TAG_NAME=${TAG_NAME#v} # remove the leading v
echo "Tag name without leading v: $TAG_NAME"
echo "::set-output name=ansible-core-version::$TAG_NAME"
- name: Build and Push
if: github.event_name == 'release'
uses: docker/build-push-action@v4
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
build-args: |
BASE_IMAGE=${{ matrix.py-base-image }}
ANSIBLE_CORE_VERSION=${{ steps.ansible-core-version.outputs.ansible-core-version }}
tags: ${{ steps.meta.outputs.tags }}