Skip to content

Linter, test, build and push KPA container #132

Linter, test, build and push KPA container

Linter, test, build and push KPA container #132

Workflow file for this run

name: Linter, test, build and push KPA container
env:
KPA_PROJECT: example
on: [push,workflow_dispatch]
jobs:
linter:
runs-on: ubuntu-latest
container:
image: ghcr.io/mmul-it/kpa-marp-pandoc:v1.1.0
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Ansible requirements
run: ansible-galaxy install
-r playbooks/roles/requirements.yml
--roles-path ./playbooks/roles
- name: Check Ansible Playbook Linter
run: ansible-lint playbooks/*.yml
- name: Check project yamls
run: yamllint -s projects/${KPA_PROJECT}/*.yml
- name: Check markdown files for example project
run: mdl projects/${KPA_PROJECT}/contents/*.md
test:
runs-on: ubuntu-latest
container:
image: ghcr.io/mmul-it/kpa-marp-pandoc:v1.1.0
needs: linter
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Ansible requirements
run: ansible-galaxy install
-r playbooks/roles/requirements.yml
--roles-path ./playbooks/roles
- name: Generate markdown and pdf files
run: for KPA_DOC in $(ls projects/${KPA_PROJECT}/*.yml); do
ansible-playbook
-e @projects/${KPA_PROJECT}/common/settings.yml
-e @${KPA_DOC}
playbooks/kpa_generator.yml;
done
- name: Upload generated markdown files
uses: actions/upload-artifact@v3
with:
name: markdowns
path: output/**.md
- name: Upload generated pdf files
uses: actions/upload-artifact@v3
with:
name: pdfs
path: output/**.pdf
build_and_push:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to ghcr
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ vars.GHCR_USER }}
password: ${{ secrets.GHCR_TOKEN }}
- name: Login to quay
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ vars.QUAY_ROBOT_NAME }}
password: ${{ secrets.QUAY_ROBOT_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
# Check https://github.com/docker/build-push-action/issues/820
provenance: false
platforms: linux/amd64,linux/arm64
tags: |
ghcr.io/mmul-it/kpa:latest
ghcr.io/mmul-it/kpa:${{ github.ref_name }}
quay.io/mmul/kpa:latest
quay.io/mmul/kpa:${{ github.ref_name }}