Add workflow for autobuild

Signed-off-by: Christian Richter <crichter@suse.com>
This commit is contained in:
Christian Richter
2021-09-03 14:35:23 +02:00
parent 5907d64d71
commit de6830f9b6
2 changed files with 43 additions and 1 deletions

42
.github/workflows/ghrunner.yml vendored Normal file
View File

@@ -0,0 +1,42 @@
name: Docker Image CI for GHRUNNER
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
env:
DOCKER_REGISTRY: ghcr.io
DOCKER_IMAGE: dragonchaser/ghrunner
DOCKER_TARGET_PLATFORM: "linux/arm/v7,linux/arm64,linux/amd64"
steps:
- uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: crazy-max/ghaction-docker-buildx@v1
with:
version: latest
- name: Prepare
if: success()
id: prepare
run: |
echo ::set-output name=docker_platform::${DOCKER_TARGET_PLATFORM}
echo ::set-output name=docker_image::${DOCKER_REGISTRY}/${DOCKER_IMAGE}
echo ::set-output name=version::latest
- name: Log into registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Run Buildx
if: success()
run: |
cd ghrunner
docker buildx build --platform ${{ steps.prepare.outputs.docker_platform }} --tag ${{ steps.prepare.outputs.docker_image }}:${{steps.prepare.outputs.version }} --file ./Dockerfile --output type=image,push=true .

View File

@@ -16,5 +16,5 @@ curl -o ${FILE} -L https://github.com/actions/runner/releases/download/v${VERSIO
echo "${CHECKSUM} ${FILE}" | shasum -a 256 -c
tar xzf ./${FILE}
./bin/installdependencies.sh
su runner -c "./config.sh --unattended --url https://github.com/${ORG}/${REPO} --token ${TOKEN} --name docker-runner-$(hostname)"
su runner -c "./config.sh --unattended --url https://github.com/${ORG}/${REPO} --token ${TOKEN} --name docker-runner-$(hostname) --labels=${ARCH},${OS},self-hosted"
su runner -c "./run.sh"