Skip to content

Commit

Permalink
improve workflows
Browse files Browse the repository at this point in the history
Signed-off-by: Markus Blaschke <[email protected]>
  • Loading branch information
mblaschke committed Oct 25, 2023
1 parent 94c9a06 commit 41a17b5
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 46 deletions.
13 changes: 9 additions & 4 deletions .github/workflows/build-docker.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
name: build/docker

on:
workflow_call: {}

workflow_call:
inputs:
publish:
required: true
type: boolean

jobs:
lint:
Expand Down Expand Up @@ -60,24 +63,26 @@ jobs:

- name: Login to DockerHub
uses: docker/login-action@v3
if: ${{ inputs.publish }}
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Login to Quay
uses: docker/login-action@v3
if: ${{ inputs.publish }}
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_TOKEN }}

- name: Build and push
- name: ${{ inputs.publish && 'Build and push' || 'Build' }}
uses: docker/build-push-action@v5
with:
context: .
file: ./${{ matrix.Dockerfile }}
target: ${{ matrix.target }}
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
push: ${{ inputs.publish }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
42 changes: 4 additions & 38 deletions .github/workflows/ci-docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,7 @@ on: [pull_request, workflow_dispatch]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set Swap Space
uses: pierotofy/set-swap-space@49819abfb41bd9b44fb781159c033dba90353a7c
with:
swap-size-gb: 12

- name: Run Golangci lint
uses: golangci/golangci-lint-action@v3
with:
version: latest
args: --print-resources-usage

- name: Docker meta
id: docker_meta
uses: docker/metadata-action@v5
with:
images: ${{ github.repository }},quay.io/${{ github.repository }}
labels: |
io.artifacthub.package.readme-url=https://raw.githubusercontent.com/${{ github.repository }}/${{ github.event.repository.default_branch }}/README.md
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: false
platforms: linux/amd64,linux/arm64
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
uses: ./.github/workflows/build-docker.yaml
secrets: inherit
with:
publish: false
Empty file removed .github/workflows/lint.yaml
Empty file.
3 changes: 2 additions & 1 deletion .github/workflows/release-docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ jobs:
release:
uses: ./.github/workflows/build-docker.yaml
secrets: inherit

with:
publish: ${{ github.event_name != 'pull_request' }}
7 changes: 4 additions & 3 deletions .github/workflows/schedule-docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ name: "schedule/docker"

on:
schedule:
- cron: '0 6 * * 1'
- cron: '0 7 * * 45'

jobs:
release:
schedule:
uses: ./.github/workflows/build-docker.yaml
secrets: inherit

with:
publish: true

0 comments on commit 41a17b5

Please sign in to comment.