added inital github workflows

This commit is contained in:
Jacob Payne
2022-08-08 16:57:37 -07:00
parent 1aac2fc928
commit d2d49a3986
9 changed files with 223 additions and 17 deletions

13
.github/workflows/common.yaml vendored Normal file
View File

@@ -0,0 +1,13 @@
on:
workflow_call:
jobs:
setup:
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: docker-practice/actions-setup-docker@master
- uses: earthly/actions-setup@v1
with:
version: "latest"

37
.github/workflows/images.yaml vendored Normal file
View File

@@ -0,0 +1,37 @@
on:
workflow_call:
inputs:
k3s-version:
type: string
required: true
base-image:
type: string
required: true
push:
type: boolean
default: false
required: false
description: If true the images will be published to the registry and signed with cosign
secrets:
QUAY_PASSWORD:
required: true
QUAY_USERNAME:
required: true
jobs:
images:
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- run: echo ${{ secrets.QUAY_PASSWORD }} | docker login -u ${{ secrets.QUAY_USERNAME }} --password-stdin quay.io
if: ${{ inputs.push }}
- run: earthly --ci --push=${{ inputs.push }} +docker --K3S_VERSION=${{ inputs.k3s-version }} --BASE_IMAGE=${{ inputs.base-image }}
with:
k3s-version: ${{ inputs.k3s-version }}
base-image: ${{ inputs.base-image }}
- run: earthly --ci +cosign --K3S_VERSION=${{ inputs.k3s-version }} --BASE_IMAGE=${{ inputs.base-image }}
if: ${{ inputs.push }}
with:
k3s-version: ${{ inputs.k3s-version }}
base-image: ${{ inputs.base-image }}

30
.github/workflows/publish.yaml vendored Normal file
View File

@@ -0,0 +1,30 @@
name: Publish
on:
push:
tags:
- v*
jobs:
build:
runs-on: ubuntu-latest
permissions:
id-token: write
strategy:
matrix:
base-image:
- quay.io/c3os-io/core-opensuse:latest
- quay.io/c3os-io/core-alpine:latest
k3s-version:
- v1.24.3+k3s1
- v1.23.9+k3s1
- v1.22.11+k3s2
- v1.21.14+k3s1
steps:
- uses: actions/checkout@v2
- uses: ./.github/workflows/common.yaml
- uses: ./.github/workflows/images.yaml
with:
push: true
k3s-version: ${{ matrix.k3s-version }}
base-image: ${{ matrix.base-image }}

36
.github/workflows/pull_request.yaml vendored Normal file
View File

@@ -0,0 +1,36 @@
name: Pull Request
on:
pull_request:
push:
branches:
- main
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ./.github/workflows/common.yaml
- run: earthly --ci +lint
build:
runs-on: ubuntu-latest
permissions:
id-token: write
strategy:
matrix:
base-image:
- quay.io/c3os-io/core-opensuse:latest
- quay.io/c3os-io/core-alpine:latest
k3s-version:
- v1.24.3+k3s1
- v1.23.9+k3s1
- v1.22.11+k3s2
- v1.21.14+k3s1
steps:
- uses: ./.github/workflows/common.yaml
- uses: ./.github/workflows/images.yaml
with:
push: false
k3s-version: ${{ matrix.k3s-version }}
base-image: ${{ matrix.base-image }}