forked from beikeni/github-runner-dockerfile
-
Notifications
You must be signed in to change notification settings - Fork 1
52 lines (46 loc) · 1.74 KB
/
build-push.yml
File metadata and controls
52 lines (46 loc) · 1.74 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
50
51
52
name: build-and-push
on:
schedule:
- cron: '52 17 * * *'
push:
branches: [ main ]
workflow_dispatch:
jobs:
build-and-push:
runs-on: ubuntu-22.04
permissions:
contents: read
packages: write
steps:
- name: Check if there is a new base image
if: github.event_name != 'push' && github.event_name != 'workflow_dispatch'
id: check
run: |
set -Eeuxo pipefail
sudo apt install -y curl jq skopeo
PARENT=$(skopeo inspect docker://ubuntu:23.10 | jq .Layers)
OWN=$(skopeo inspect docker://ghcr.io/marius/github-actions-runner | jq .Layers)
OUTOFDATE=$(jq -cn "$OWN - ($OWN - $PARENT) | .==[]")
echo "out-of-date=$OUTOFDATE" >> $GITHUB_OUTPUT
- name: Checkout repository
if: steps.check.outputs.out-of-date == 'true' || github.event_name == 'push' || github.event_name == 'workflow_dispatch'
uses: actions/checkout@v4
- name: Build image
if: steps.check.outputs.out-of-date == 'true' || github.event_name == 'push' || github.event_name == 'workflow_dispatch'
id: build
uses: redhat-actions/buildah-build@v2
with:
image: github-actions-runner
tags: latest
containerfiles: |
./Dockerfile
- name: Push to ghcr.io
if: steps.check.outputs.out-of-date == 'true' || github.event_name == 'push' || github.event_name == 'workflow_dispatch'
id: push
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build.outputs.image }}
tags: ${{ steps.build.outputs.tags }}
registry: ghcr.io/marius
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}