-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (52 loc) · 1.63 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
---
name: Build Github Runner image for Ploigos and related tools
on:
push:
pull_request_target:
types:
- opened
- edited
- synchronize
workflow_dispatch:
permissions:
pull-requests: write
jobs:
build:
if: github.ref_name == 'main' || startsWith(github.ref, 'refs/heads/feature/')
name: Build and Push Image to Public Container Registry
runs-on: ubuntu-latest
env:
IMAGE_NAME: ploigos-github-runner
REGISTRY: quay.io/ploigos
steps:
- name: Clone the Repository
uses: actions/checkout@v3
- name: Create Tag Name
run: |
if [ ${{ github.ref_name }} == main ]; then
echo "TAG_NAME=latest" >> $GITHUB_ENV
else
BRANCH_NAME=${{ github.ref_name }}
TAG="${BRANCH_NAME////-}"
echo "TAG_NAME=$TAG" >> $GITHUB_ENV
fi
- name: Build Image
id: build-image
uses: redhat-actions/[email protected]
with:
image: ${{ env.IMAGE_NAME }}
tags: ${{ env.TAG_NAME }} ${{ github.sha }}
containerfiles: |
./Containerfile
- name: Login to Container Registry
uses: redhat-actions/[email protected]
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.QUAY_GITHUB_RUNNERS_USERNAME }}
password: ${{ secrets.QUAY_GITHUB_RUNNERS_TOKEN }}
- name: Push to Container Registry
uses: redhat-actions/[email protected]
with:
image: ${{ steps.build-image.outputs.image }}
tags: ${{ steps.build-image.outputs.tags }}
registry: ${{ env.REGISTRY }}