This repository was archived by the owner on Oct 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
49 lines (47 loc) · 1.39 KB
/
Copy pathbuild_operator.yml
File metadata and controls
49 lines (47 loc) · 1.39 KB
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 operator and optionally push image
on:
pull_request:
paths:
- operator/**
push:
branches:
- "master"
tags:
- "*"
workflow_dispatch:
defaults:
run:
working-directory: ./operator
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: RyanSiu1995/kubebuilder-action@v1.2.1
- name: Generate docker tags
env:
IMAGENAME: joeshearn/github-runner-autoscaler-operator
run: |
set -x
echo "$IMAGENAME"
TAGS="$IMAGENAME:$(printf %06d $GITHUB_RUN_NUMBER)"
REF=$(echo "$GITHUB_REF" | sed 's/\/?refs\/(tags|heads)\///g' -E)
TAGS="$TAGS,$IMAGENAME:$REF"
if [[ $GITHUB_REF == *"/tags/"* ]]; then
TAGS="$TAGS,$IMAGENAME:latest"
fi
echo "TAGS=$TAGS" | tee -a $GITHUB_ENV
- run: make && make test
- name: Login
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
uses: docker/login-action@v1.8.0
with:
username: joeshearn
password: ${{ secrets.dockerhub_pass }}
- name: Build and push Docker image
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
uses: docker/build-push-action@v2.3.0
with:
context: ./operator
tags: ${{ env.TAGS }}
push: "true"