Skip to content

Bump runner image

Bump runner image #28

Workflow file for this run

name: Push
on: [push]
jobs:
test:
name: Test
runs-on: ubuntu-22.04
steps:
- name: Set up Go 1.13.8
uses: actions/setup-go@v1
with:
go-version: 1.13.8
id: go
- name: Check out code
uses: actions/checkout@v2
- name: Cache go mod download
uses: actions/cache@v1
with:
path: /home/runner/go/pkg/mod
key: ${{ runner.os }}-gomod-${{ hashFiles(format('{0}{1}', github.workspace, '/go.sum')) }}
restore-keys: |
${{ runner.os }}-gomod-
- name: Cache go build
uses: actions/cache@v1
with:
path: /home/runner/.cache/go-build
key: ${{ runner.os }}-go-${{ hashFiles(format('{0}{1}', github.workspace, '/**/*.go')) }}
restore-keys: |
${{ runner.os }}-go-
- name: Test
run: go test ./... -race -bench . -benchmem -trimpath
publish:
name: Publish
runs-on: ubuntu-22.04
needs: [test]
env:
OWNER: kaidotdev
REPOSITORY_NAME: spinnaker-dcd-controller
IMAGE_NAME: spinnaker-dcd-controller
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Cache docker build
id: docker-cache
uses: actions/cache@v1
with:
path: /home/runner/.cache/docker-build
key: ${{ runner.os }}-docker-${{ hashFiles(format('{0}{1}', github.workspace, '/Dockerfile')) }}-${{ hashFiles(format('{0}{1}', github.workspace, '/go.sum')) }}-${{ hashFiles(format('{0}{1}', github.workspace, '/**/*.go')) }}
restore-keys: |
${{ runner.os }}-docker-
- name: Set up Docker Buildx
id: buildx
uses: crazy-max/ghaction-docker-buildx@v1
with:
version: v0.3.1
- name: Publish
run: |
IMAGE_PATH=ghcr.io/${OWNER}/${IMAGE_NAME}
TAG=${GITHUB_REF##*/}
opt=''
[ -d /home/runner/.cache/docker-build ] && opt='--cache-from type=local,src=/home/runner/.cache/docker-build'
docker login ghcr.io -u $OWNER -p ${{ secrets.GITHUB_TOKEN }}
docker buildx build --output type=docker,name=$IMAGE_PATH:$TAG,push=false ${opt} --cache-to type=local,mode=max,dest=/home/runner/.cache/docker-build .
docker push $IMAGE_PATH:$TAG