This repository has been archived by the owner on May 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
83 lines (71 loc) · 2.19 KB
/
main.yaml
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
name: Main
on:
pull_request:
push:
branches: [master]
jobs:
kubeval:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: validate
uses: instrumenta/kubeval-action@master
with:
files: ./deploy
strict: false
version: "1.18.12"
build:
name: Build
runs-on: ubuntu-20.04
needs: unit-tests
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Restore docker cache
uses: actions/cache@v2
with:
path: ~/docker-cache
key: aegir-docker-${{ github.sha }}
restore-keys: |
aegir-docker-${{ github.sha }}
- name: build final docker image
run: |
docker load < ~/docker-cache/aegir-test.tar
make docker_build
make docker_test
mkdir -p ~/docker-cache-final-image
docker save -o ~/docker-cache-final-image/aegir.tar vivareal/aegir
- name: Save docker cache final image
uses: actions/cache@v2
with:
path: ~/docker-cache-final-image
key: aegir-docker-final-image-${{ github.sha }}
publish:
name: publish
needs: build
runs-on: ubuntu-20.04
steps:
- name: "Get release name"
id: "release-name"
run: "echo \"::set-output name=release::${GITHUB_REF##*/}\""
- name: Checkout repo
uses: actions/checkout@v2
- name: Restore docker cache
uses: actions/cache@v2
with:
path: ~/docker-cache-final-image
key: aegir-docker-final-image-${{ github.sha }}
restore-keys: |
aegir-docker-final-image-${{ github.sha }}
- name: Load tar file
run: docker load < ~/docker-cache-final-image/aegir.tar
- name: Docker login
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: tag publish docker image
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
run: |
docker tag vivareal/aegir:build vivareal/aegir:master
docker push vivareal/aegir:master