-
Notifications
You must be signed in to change notification settings - Fork 2
136 lines (132 loc) · 5.07 KB
/
build_k8s.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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
name: Build
on: [push, pull_request]
concurrency:
group: build-${{ github.head_ref || github.ref }}-${{ github.repository }}
cancel-in-progress: true
jobs:
generate-matrix:
name: Generate matrix for build
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v2
- name: Install deps
run: |
curl https://get.mocaccino.org/luet/get_luet_root.sh | sudo sh
sudo luet install utils/jq
- name: Set matrix for build
id: set-matrix
run: |
JSON="{\"include\":"
JSONline="$(luet tree pkglist --tree packages -o json | jq -rc '.packages')"
JSON="$JSON$JSONline"
JSON="$JSON}"
# Set output
echo "::set-output name=matrix::$( echo "$JSON" )"
build:
needs: generate-matrix
strategy:
matrix: ${{fromJson(needs.generate-matrix.outputs.matrix)}}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Release space from worker
run: |
sudo rm -rf /usr/local/lib/android # will release about 10 GB if you don't need Android
sudo rm -rf /usr/share/dotnet # will release about 20GB if you don't need .NET
- run: |
git fetch --prune --unshallow
- name: Login to Quay Registry
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
run: echo ${{ secrets.QUAY_ROBOT_PASSWORD }} | sudo docker login -u ${{ secrets.QUAY_ROBOT_USERNAME }} --password-stdin quay.io
- name: Build 🔧
uses: mudler/luet-github-action@master
if: ${{ github.event_name == 'push' && github.ref != 'refs/heads/master' }}
with:
# tree: packages
build: true
onlyMissing: true
FINAL_REPO: quay.io/mocaccino/kernel
pushCache: false
CURRENT_PACKAGE: ${{ matrix.category }}/${{ matrix.name }}@${{ matrix.version }}
- name: Build 🔧
uses: mudler/luet-github-action@master
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
with:
# tree: packages
build: true
FINAL_REPO: quay.io/mocaccino/kernel
DOCKER_USERNAME: ${{ secrets.QUAY_ROBOT_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.QUAY_ROBOT_PASSWORD }}
DOCKER_ENDPOINT: quay.io
onlyMissing: true
pushCache: true
CURRENT_PACKAGE: ${{ matrix.category }}/${{ matrix.name }}@${{ matrix.version }}
# Repository used to pull images from. needed if you list any repo in .luet.yaml
#PULL_REPOSITORY: quay.io/mocaccinocache/desktop
- uses: actions/upload-artifact@v2
with:
name: ${{ matrix.category }}-${{ matrix.name }}-${{ matrix.version }}.zip
path: |
build/
create-repo:
needs: build
env:
FINAL_REPO: quay.io/mocaccino/kernel
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: |
git fetch --prune --unshallow
- name: Login to Quay Registry
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
run: echo ${{ secrets.QUAY_ROBOT_PASSWORD }} | docker login -u ${{ secrets.QUAY_ROBOT_USERNAME }} --password-stdin quay.io
- name: Login to Quay Registry
if: startsWith(github.ref, 'refs/tags/')
run: echo ${{ secrets.QUAY_ROBOT_PASSWORD }} | docker login -u ${{ secrets.QUAY_ROBOT_USERNAME }} --password-stdin quay.io
- name: Download all workflow run artifacts
uses: actions/download-artifact@v2
- name: Merge artifacts 🔧
run: |
mkdir build || true
for i in $(ls | grep zip); do
cp -rfv $i/* build
done
ls -liah
ls -liah build
- name: Download meta
uses: mudler/luet-github-action@master
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
with:
# tree: packages
downloadMeta: true
downloadAllMeta: true
FINAL_REPO: quay.io/mocaccino/kernel
REPOSITORY_TYPE: docker
- name: Create repo 🔧
uses: mudler/luet-github-action@master
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
with:
DOCKER_USERNAME: ${{ secrets.QUAY_ROBOT_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.QUAY_ROBOT_PASSWORD }}
DOCKER_ENDPOINT: quay.io
# tree: packages
createRepo: true
pushCache: true
FINAL_REPO: quay.io/mocaccino/kernel
REPOSITORY_TYPE: docker
- name: Push to stable repository 🚀
if: startsWith(github.ref, 'refs/tags/')
run: |
curl https://get.mocaccino.org/luet/get_luet_root.sh | sudo sh
sudo luet install -y repository/mocaccino-extra-stable
sudo luet install -y container/skopeo
src="quay.io/mocaccino/kernel"
dst="quay.io/mocaccino/kernel-stable"
skopeo login quay.io
tags=$(skopeo list-tags docker://$src | jq '.Tags')
for i in $(echo "$tags" | jq -rc '.[]'); do
echo "Copy docker://$src:$i docker://$dst:$i"
skopeo copy docker://$src:$i docker://$dst:$i
done