forked from kubernetes-sigs/kubespray
-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (37 loc) · 1.38 KB
/
execution-environment.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
name: Build and Publish Ansible Image
on:
push:
branches:
- main
pull_request:
jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.11'
- name: downcase REPO
run: |
echo "OWNER=${GITHUB_REPOSITORY_OWNER,,}" >>${GITHUB_ENV}
- name: Install ansible-builder
run: pip install ansible-builder
- name: Build Ansible Image
run: ansible-builder build --tag kubespray-ee:${{ github.sha }} --tag ghcr.io/${{ env.OWNER }}/kubespray-ee --container-runtime docker
- name: Tag image with PR name
if: github.event_name == 'pull_request'
run: docker tag kubespray-ee:${{ github.sha }} kubespray-ee:pr-${{ github.event.number }}
- name: Tag image with latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: docker tag kubespray-ee:${{ github.sha }} kubespray-ee:latest
- name: Log in to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push Image to GitHub Container Registry
run: docker push -a ghcr.io/${{ env.OWNER }}/kubespray-ee