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
Expand file tree
/
Copy pathbuild_GithubRunnerRegistration.yaml
More file actions
41 lines (40 loc) · 1.58 KB
/
Copy pathbuild_GithubRunnerRegistration.yaml
File metadata and controls
41 lines (40 loc) · 1.58 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
# Janky way of rebuilding images when myoung34/github-runner:latest changes
name: Build the GithubRunnerRegistration on push or if the base image has changed (on a schedule)
on:
push:
branches:
- "master"
paths:
- "GithubRunnerRegistration/**"
schedule:
- cron: "30 */6 * * *"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Login
uses: docker/login-action@v1.8.0
with:
username: joeshearn
password: ${{ secrets.dockerhub_pass }}
- run: echo ${{github.event_name}}
- run: echo ${{github.event_name == 'push'}}
- run: |
docker pull myoung34/github-runner:latest
BASE_ID="$(docker image ls myoung34/github-runner:latest --format '{{.ID}}')"
SHOULD_RELEASE=0
if ! curl https://registry.hub.docker.com/v1/repositories/joeshearn/github-runner-registration/tags | jq '.[].name' | grep $BASE_ID; then
SHOULD_RELEASE=1
fi
TAG="$(printf %06d $GITHUB_RUN_NUMBER)_$BASE_ID"
echo "TAG=$TAG" | tee -a $GITHUB_ENV
echo "SHOULD_RELEASE=$SHOULD_RELEASE" | tee -a $GITHUB_ENV
- name: Build and push Docker image
if: github.event_name == 'push' || env.SHOULD_RELEASE == '1'
uses: docker/build-push-action@v2.3.0
with:
context: ./GithubRunnerRegistration
file: ./GithubRunnerRegistration/GithubRunnerRegistration.Api/Dockerfile
tags: joeshearn/github-runner-registration:${{ env.TAG }},joeshearn/github-runner-registration:latest
push: "true"