-
Notifications
You must be signed in to change notification settings - Fork 1
57 lines (49 loc) · 1.82 KB
/
build-self.hosted.runner.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
# Builds a self-hosted runner from the base image
name: Build self-hosted runner
on:
workflow_dispatch:
env:
APP_NAME: gh-runner
DOCKER_ARTIFACTORY_REPO: artifacts.developer.gov.bc.ca/docker-remote
DOCKER_ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
DOCKER_ARTIFACTORY_ACCESS_TOKEN: ${{ secrets.ARTIFACTORY_ACCESS_TOKEN }}
IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }}
IMAGE_REGISTRY_USER: ${{ github.actor }}
IMAGE_REGISTRY_PASSWORD: ${{ github.token }}
IMAGE_TAGS: latest
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v2
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
registry: ${{ env.DOCKER_ARTIFACTORY_REPO }}
username: ${{ env.DOCKER_ARTIFACTORY_USERNAME }}
password: ${{ env.DOCKER_ARTIFACTORY_ACCESS_TOKEN }}
# https://github.com/redhat-actions/buildah-build#readme
- name: Build runner from Dockerfile
id: build-image
uses: redhat-actions/buildah-build@v2
with:
image: ${{ env.APP_NAME }}
tags: ${{ env.IMAGE_TAGS }}
dockerfiles: |
./github-self-hosted-runner/self_hosted_gh_runner/Dockerfile
context: ./github-self-hosted-runner/self_hosted_gh_runner
# https://github.com/redhat-actions/push-to-registry#readme
- name: Push image to registry
id: push-image
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build-image.outputs.image }}
tags: ${{ steps.build-image.outputs.tags }}
registry: ${{ env.IMAGE_REGISTRY }}
username: ${{ env.IMAGE_REGISTRY_USER }}
password: ${{ env.IMAGE_REGISTRY_PASSWORD }}
- name: Echo output
id: echo-output
run: |
echo ${{ steps.push-image.outputs.registry-path }}