updating gha's

This commit is contained in:
Bret Fisher
2022-01-17 01:22:59 -05:00
parent 3ca32162bd
commit 38e574fd4e
5 changed files with 43 additions and 151 deletions

View File

@@ -4,4 +4,4 @@ updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
interval: "monthly"

View File

@@ -1,2 +0,0 @@
rules:
missing_tag: off

7
.github/linters/.markdown-lint.yml vendored Normal file
View File

@@ -0,0 +1,7 @@
# MD013/line-length - Line length
MD013:
# Number of characters
line_length: 150
# Number of characters for headings
heading_line_length: 100
code_blocks: false

View File

@@ -1,5 +1,5 @@
---
name: Build and Push Image
name: Build and Push Images
on:
# we want pull requests so we can build(test) but not push to image registry
@@ -22,108 +22,30 @@ on:
schedule:
# re-run montly to keep image fesh with upstream base images
- cron: '0 12 15 * *'
workflow_dispatch:
# run whenever we want!
jobs:
build-and-push-images:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2.4.0
-
# we need qemu and buildx so we can build multiple platforms later
name: Set up QEMU
uses: docker/setup-qemu-action@v1.2.0
-
name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
-
# This makes image builds fast!
name: Cache Docker layers
uses: actions/cache@v2.1.7
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
-
name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Login to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Docker meta
id: docker_meta
uses: docker/metadata-action@v3.6.2
with:
# list of Docker images to use as base name for tags
images: |
bretfisher/jekyll
ghcr.io/bretfisher/jekyll
flavor: |
latest=false
tags: |
type=raw,value=latest
-
# this will build the images, once per platform,
# then push to both Docker Hub and GHCR
name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
target: jekyll
platforms: linux/amd64,linux/arm64,linux/arm/v7
builder: ${{ steps.buildx.outputs.name }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
# don't push during a pull_request, only build
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
-
name: Show image digest
run: echo ${{ steps.docker_build.outputs.digest }}
-
# steps for 2nd image jekyll-serve, based on above jekyll image layers
name: Docker meta jekyll-serve
id: docker_meta_jekyll_serve
uses: docker/metadata-action@v3.6.2
with:
# list of Docker images to use as base name for tags
images: |
bretfisher/jekyll-serve
ghcr.io/bretfisher/jekyll-serve
flavor: |
latest=false
tags: |
type=raw,value=latest
-
# this will build the images, once per platform, then push to both hub and ghcr
name: Build and push jekyll-serve
uses: docker/build-push-action@v2
with:
target: jekyll-serve
platforms: linux/amd64,linux/arm64,linux/arm/v7
builder: ${{ steps.buildx.outputs.name }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
# don't push during a pull_request, only build
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.docker_meta_jekyll_serve.outputs.tags }}
labels: ${{ steps.docker_meta_jekyll_serve.outputs.labels }}
-
name: Show image digest
run: echo ${{ steps.docker_build.outputs.digest }}
build-jekyll-image:
# use Reusable Workflows
# https://docs.github.com/en/actions/learn-github-actions/reusing-workflows
uses: bretfisher/github-actions-templates/.github/workflows/docker-build-and-push.yaml@main
with:
image-names: |
bretfisher/jekyll
ghcr.io/bretfisher/jekyll
target: jekyll
secrets:
dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }}
build-jekyll-serve-image:
# use Reusable Workflows
# https://docs.github.com/en/actions/learn-github-actions/reusing-workflows
uses: bretfisher/github-actions-templates/.github/workflows/docker-build-and-push.yaml@main
with:
image-names: |
bretfisher/jekyll-serve
ghcr.io/bretfisher/jekyll-serve
target: jekyll-serve
secrets:
dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }}

View File

@@ -1,54 +1,19 @@
---
###########################
###########################
## Linter GitHub Actions ##
###########################
###########################
name: Lint Code Base
#
# Documentation:
# https://help.github.com/en/articles/workflow-syntax-for-github-actions
#
#############################
# Start the job on all push #
#############################
on:
push:
branches: [main]
pull_request:
branches: [main]
###############
# Set the Job #
###############
jobs:
build:
# Name the Job
name: Lint Code Base
# Set the agent to run on
runs-on: ubuntu-latest
##################
# Load all steps #
##################
steps:
##########################
# Checkout the code base #
##########################
- name: Checkout Code
uses: actions/checkout@v2.4.0
with:
# Full git history is needed to get a proper list of changed files within `super-linter`
fetch-depth: 0
################################
# Run Linter against code base #
################################
- name: Lint Code Base
uses: github/super-linter@v4.8.5
env:
VALIDATE_ALL_CODEBASE: false
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
call-super-linter:
# use Reusable Workflows to call my linter config remotely
# https://docs.github.com/en/actions/learn-github-actions/reusing-workflows
uses: bretfisher/super-linter-workflow/.github/workflows/super-linter.yaml@main
# with:
# disable common code linters
# devops-only: true
# prevent scanning a comma separated regex list
#filter-regex-exclude: .*compose-sample-3/html/.*