Skip to content

Commit

Permalink
update workflows
Browse files Browse the repository at this point in the history
Signed-off-by: Markus Blaschke <mblaschke82@gmail.com>
  • Loading branch information
mblaschke committed Dec 18, 2023
1 parent 944ed6b commit 4f2e74e
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 241 deletions.
65 changes: 38 additions & 27 deletions .github/release-docker.yaml → .github/workflows/build-docker.yaml
Original file line number Diff line number Diff line change
@@ -1,56 +1,64 @@
name: "Release: docker"
name: build/docker

on:
push:
branches:
- '**'
tags:
- '*.*.*'
workflow_call:
inputs:
publish:
required: true
type: boolean

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

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

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

build:
name: "build ${{ matrix.Dockerfile }}:${{ matrix.target }}"
needs: lint
strategy:
fail-fast: false
matrix:
Dockerfile: [Dockerfile.ubuntu]
suffix: ["-ubuntu"]
latest: ["auto"]
include:
- Dockerfile: Dockerfile.alpine
suffix: -alpine
-
Dockerfile: Dockerfile
target: "final-ubuntu"
suffix: "-ubuntu"
latest: "auto"
-
Dockerfile: Dockerfile
target: "final-alpine"
suffix: "-alpine"
latest: false
- Dockerfile: Dockerfile.debian
suffix: -debian
-
Dockerfile: Dockerfile
target: "final-debian"
suffix: "-debian"
latest: false

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

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

- name: Docker meta
id: docker_meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: ${{ github.repository }},quay.io/${{ github.repository }}
labels: |
Expand All @@ -60,30 +68,33 @@ jobs:
suffix=${{ matrix.suffix }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v3

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

- name: Login to DockerHub
uses: docker/login-action@v1
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@v1
uses: docker/login-action@v3
if: ${{ inputs.publish }}
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v2
- name: ${{ inputs.publish && 'Build and push' || 'Build' }}
uses: docker/build-push-action@v5
with:
context: .
file: ./${{ matrix.Dockerfile }}
platforms: linux/amd64,linux/arm64,linux/arm
push: ${{ github.event_name != 'pull_request' }}
target: ${{ matrix.target }}
platforms: linux/amd64,linux/arm64
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
2 changes: 1 addition & 1 deletion .github/workflows/release-assets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
with:
swap-size-gb: 12

- uses: actions/setup-go@v4
- uses: actions/setup-go@v5
with:
go-version: '1.21'
check-latest: true
Expand Down
92 changes: 5 additions & 87 deletions .github/workflows/release-docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,90 +10,8 @@ on:
- '*.*.*'

jobs:
lint:
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

build:
name: "build ${{ matrix.Dockerfile }}:${{ matrix.target }}"
needs: lint
strategy:
fail-fast: false
matrix:
include:
-
Dockerfile: Dockerfile
target: "final-ubuntu"
suffix: "-ubuntu"
latest: "auto"
-
Dockerfile: Dockerfile
target: "final-alpine"
suffix: "-alpine"
latest: false
-
Dockerfile: Dockerfile
target: "final-debian"
suffix: "-debian"
latest: false
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: 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
flavor: |
latest=${{ matrix.latest }}
suffix=${{ matrix.suffix }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

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

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

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

- name: Build and push
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' }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
release:
uses: ./.github/workflows/build-docker.yaml
secrets: inherit
with:
publish: ${{ github.event_name != 'pull_request' }}
94 changes: 6 additions & 88 deletions .github/workflows/schedule-docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,93 +2,11 @@ name: "schedule/docker"

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

jobs:
lint:
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

build:
name: "build ${{ matrix.Dockerfile }}:${{ matrix.target }}"
needs: lint
strategy:
fail-fast: false
matrix:
include:
-
Dockerfile: Dockerfile
target: "final-ubuntu"
suffix: "-ubuntu"
latest: "auto"
-
Dockerfile: Dockerfile
target: "final-alpine"
suffix: "-alpine"
latest: false
-
Dockerfile: Dockerfile
target: "final-debian"
suffix: "-debian"
latest: false
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: 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
flavor: |
latest=${{ matrix.latest }}
suffix=${{ matrix.suffix }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

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

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

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

- name: Build and push
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' }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
schedule:
uses: ./.github/workflows/build-docker.yaml
secrets: inherit
with:
publish: true

0 comments on commit 4f2e74e

Please sign in to comment.