-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (41 loc) · 1.29 KB
/
build.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
---
name: Build kube-resources images
on:
push:
tag:
- 'v*'
env:
IMAGE_REGISTRY: "ghcr.io"
REGISTRY_USER: "${{ github.repository_owner }}"
REGISTRY_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
IMAGE_REPO: "ghcr.io/${{ github.repository_owner }}"
IMAGE_NAMR: "kube-resources"
jobs:
build:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
with:
# fetch all git repo tag for define image tag
fetch-depth: 0
- name: Log in to GitHub Docker Registry
uses: docker/login-action@v1
with:
registry: ${{ env.IMAGE_REGISTRY }}
username: ${{ env.REGISTRY_USER }}
password: ${{ env.REGISTRY_TOKEN }}
- name: Download files
run: |
git describe --tags --always | sed 's/^/KUBE_VERSION=/' >> $GITHUB_ENV
source $GITHUB_ENV
KUBE_VERSION=${KUBE_VERSION} bash download.sh
echo -e "FROM scratch\nCOPY kube /kube" > Dockerfile
- name: Build and push kube-resources image
uses: docker/build-push-action@v2
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
file: Dockerfile
tags: ${IMAGE_REPO}/${IMAGE_NAME}:${KUBE_VERSION}