gha upgrade (#46)

This commit is contained in:
Bret Fisher
2022-05-15 18:02:27 -04:00
committed by GitHub
parent 1d617af967
commit 3cc0fa0837
8 changed files with 208 additions and 54 deletions

View File

@@ -0,0 +1,81 @@
---
# template source: https://github.com/bretfisher/docker-build-workflow/blob/main/templates/call-docker-build.yaml
name: Docker Build
on:
push:
branches:
- main
# don't rebuild image if someone only edited unrelated files
paths-ignore:
- 'README.md'
- '.github/linters/**'
pull_request:
# don't rebuild image if someone only edited unrelated files
paths-ignore:
- 'README.md'
- '.github/linters/**'
jobs:
call-docker-build:
name: Call Docker Build
uses: bretfisher/docker-build-workflow/.github/workflows/reusable-docker-build.yaml@main
permissions:
contents: read
packages: write # needed to push docker image to ghcr.io
pull-requests: write # needed to create and update comments in PRs
secrets:
# Only needed if with:dockerhub-enable is true below
dockerhub-username: ${{ secrets.DOCKERHUB_USERNAME }}
# Only needed if with:dockerhub-enable is true below
# https://hub.docker.com/settings/security
dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }}
with:
### REQUIRED
### ENABLE ONE OR BOTH REGISTRIES
### tell docker where to push.
### NOTE if Docker Hub is set to true, you must set secrets above and also add account/repo/tags below
dockerhub-enable: true
ghcr-enable: true
### REQUIRED
### A list of the account/repo names for docker build. List should match what's enabled above
### defaults to:
image-names: |
bretfisher/shpod
ghcr.io/${{ github.repository }}
### REQUIRED set rules for tagging images, based on special action syntax:
### https://github.com/docker/metadata-action#tags-input
### defaults to:
# tag-rules: |
# type=raw,value=latest,enable=${{ endsWith(github.ref, github.event.repository.default_branch) }}
# type=ref,event=pr
# type=ref,event=branch
# type=semver,pattern={{version}}
### path to where docker should copy files into image
### defaults to root of repository (.)
# context: .
### Dockerfile alternate name. Default is Dockerfile (relative to context path)
# file: Containerfile
### build stage to target, defaults to empty, which builds to last stage in Dockerfile
# target:
### platforms to build for, defaults to linux/amd64
### other options: linux/amd64,linux/arm64,linux/arm/v7
# platforms: linux/amd64
### Create a PR comment with image tags and labels
### defaults to false
# comment-enable: false

View File

@@ -0,0 +1,36 @@
---
# template source: https://github.com/bretfisher/super-linter-workflow/blob/main/templates/call-super-linter.yaml
name: Lint Code Base
on:
push:
branches: [main]
pull_request:
jobs:
call-super-linter:
name: Call Super-Linter
permissions:
contents: read # clone the repo to lint
statuses: write #read/write to repo custom statuses
### use Reusable Workflows to call my workflow remotely
### https://docs.github.com/en/actions/learn-github-actions/reusing-workflows
### you can also call workflows from inside the same repo via file path
uses: bretfisher/super-linter-workflow/.github/workflows/reusable-super-linter.yaml@main
### Optional settings examples
# with:
### For a DevOps-focused repository. Prevents some code-language linters from running
### defaults to false
# devops-only: false
### A regex to exclude files from linting
### defaults to empty
# filter-regex-exclude: src/.*

View File

@@ -1,34 +0,0 @@
---
name: Build and Push Image
on:
# we want pull requests so we can build(test) but not push to image registry
pull_request:
branches:
- 'main'
# only build when important files change
paths-ignore:
- 'README.md'
- '.github/workflows/linter.yml'
- '.github/linters/**'
push:
branches:
- 'main'
# only build when important files change
paths-ignore:
- 'README.md'
- '.github/workflows/linter.yml'
- '.github/linters/**'
schedule:
# re-run montly to keep image fesh with upstream base images
- cron: '0 12 15 * *'
workflow_dispatch:
# run whenever we want!
jobs:
call-docker-workflow:
# 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
secrets:
dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }}

View File

@@ -1,14 +0,0 @@
---
name: Lint Code Base
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
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