-
Notifications
You must be signed in to change notification settings - Fork 6
107 lines (96 loc) · 3.21 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
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: Login to docker.io
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: docker.io
username: ${{ vars.DOCKER_USER }}
password: ${{ secrets.DOCKER_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 }}
docker.io/mmul/kpa:latest
docker.io/mmul/kpa:${{ github.ref_name }}