Skip to content

Commit

Permalink
Fixing Docker Build and Push for Runner Image (#115)
Browse files Browse the repository at this point in the history
A new image tag for the runner stopped being published on master merges from changes in #86.

This fixes that in the following ways:
- Tests the GH workflow on PRs w/o pushing the images
- Runner and Docker version are moved from Makefile to GH Actions workflow and are passed in as build args
- GHA workflow runs on PRs, and if the workflow file itself is changed (i.e. version bump) or the runner Docker source changes (excluding the Makefile since thats just for local dev)
- Images are pushed on push (i.e. a merge)
  • Loading branch information
onelapahead authored Oct 9, 2020
1 parent f12bb76 commit c986c55
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 56 deletions.
39 changes: 28 additions & 11 deletions .github/workflows/build-runner.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
on:
pull_request:
branches:
- '**'
paths:
- 'runner/**'
- .github/workflows/build-runner.yml
push:
branches:
- master
paths:
- 'runner/**'

- runner/patched/*
- runner/Dockerfile
- runner/entrypoint.sh
- .github/workflows/build-runner.yml
name: Runner
jobs:
build:
runs-on: ubuntu-latest
name: Build runner
name: Build
env:
RUNNER_VERSION: 2.273.5
DOCKER_VERSION: 19.03.12
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -19,16 +31,21 @@ jobs:
with:
buildx-version: latest

- name: Login to GitHub Docker Registry
run: echo "${DOCKERHUB_PASSWORD}" | docker login -u "${DOCKERHUB_USERNAME}" --password-stdin
env:
DOCKERHUB_USERNAME: summerwind
DOCKERHUB_PASSWORD: ${{ secrets.DOCKER_ACCESS_TOKEN }}

- name: Build Container Image
working-directory: runner
run: |
docker buildx build \
--build-arg RUNNER_VERSION=${RUNNER_VERSION} \
--build-arg DOCKER_VERSION=${DOCKER_VERSION} \
--platform linux/amd64,linux/arm64 \
--tag summerwind/actions-runner:latest \
-f Dockerfile . --push
--tag summerwind/actions-runner:v${RUNNER_VERSION} \
-f Dockerfile .
- name: Push Container Image
working-directory: runner
run: |
docker login -u summerwind --password-stdin <<<${{ secrets.DOCKER_ACCESS_TOKEN }}
docker push summerwind/actions-runner:v${RUNNER_VERSION}
docker tag summerwind/actions-runner:v${RUNNER_VERSION} summerwind/actions-runner:latest
docker push summerwind/actions-runner:latest
if: ${{ github.event_name == 'push' }}
45 changes: 0 additions & 45 deletions .github/workflows/build.yml

This file was deleted.

0 comments on commit c986c55

Please sign in to comment.