move pipeline to github native, remove redundant dockerfiles, and add helper actions
This commit is contained in:
parent
f5aa55a1db
commit
eeb0198e3d
6 changed files with 186 additions and 48 deletions
106
.github/workflows/docker.yaml
vendored
Normal file
106
.github/workflows/docker.yaml
vendored
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
name: varken
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 10 * * *'
|
||||
push:
|
||||
branches: master
|
||||
tags:
|
||||
- 'v*.*.*'
|
||||
paths:
|
||||
- 'varken/**'
|
||||
- 'Varken.py'
|
||||
- 'Dockerfile'
|
||||
pull_request:
|
||||
branches: master
|
||||
paths:
|
||||
- 'varken/**'
|
||||
- 'Varken.py'
|
||||
- 'Dockerfile'
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
description: 'Use this tag instead of most recent'
|
||||
required: false
|
||||
ignore-existing-tag:
|
||||
description: 'Ignore existing tag if "true"'
|
||||
required: false
|
||||
env:
|
||||
IMAGES: ${{ github.repository_owner }}/${{ github.workflow }}
|
||||
PLATFORMS: "linux/amd64,linux/arm64,linux/arm/v7"
|
||||
jobs:
|
||||
lint-and-test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-verison: '3.x'
|
||||
run: pip install flake8
|
||||
- name: Lint
|
||||
run: flake8 --max-line-length 120 Varken.py varken/*.py
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
needs: lint-and-test
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Prepare
|
||||
id: prep
|
||||
run: |
|
||||
VERSION=edge
|
||||
if [[ $GITHUB_REF == refs/tags/* ]]; then
|
||||
VERSION=${GITHUB_REF#refs/tags/v}
|
||||
fi
|
||||
if [ "${{ github.event_name }}" = "schedule" ]; then
|
||||
VERSION=nightly
|
||||
fi
|
||||
TAGS="${VERSION}"
|
||||
if [[ $VERSION =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
|
||||
TAGS="$TAGS,latest"
|
||||
fi
|
||||
echo ::set-output name=version::${VERSION}
|
||||
echo ::set-output name=tags::${TAGS}
|
||||
echo ::set-output name=build_date::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
|
||||
echo ::set-output name=vcs_ref::${GITHUB_SHA::8}
|
||||
- uses: ./.github/actions/docker-target-image-list-action
|
||||
name: Generate Target Images
|
||||
id: gen-tags
|
||||
with:
|
||||
images: ${{ env.IMAGES }}
|
||||
tags: ${{ steps.prep.outputs.tags }}
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
with:
|
||||
platforms: ${{ env.PLATFORMS }}
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
with:
|
||||
install: true
|
||||
version: latest
|
||||
driver-opts: image=moby/buildkit:master
|
||||
- name: Docker Multi Login
|
||||
uses: ./.github/actions/docker-multi-login-action
|
||||
env:
|
||||
secrets: ${{ toJSON(secrets) }}
|
||||
- name: Build and Push
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
platforms: ${{ env.PLATFORMS }}
|
||||
pull: true
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ steps.gen-tags.outputs.fully-qualified-target-images }}
|
||||
build-args: |
|
||||
VERSION=${{ steps.prep.outputs.version }}
|
||||
BUILD_DATE=${{ steps.prep.outputs.build_date }}
|
||||
VCS_REF=${{ steps.prep.outputs.vcs_ref }}
|
||||
- name: Inspect
|
||||
if: ${{ github.event_name != 'pull_request' }}
|
||||
run: |
|
||||
IFS=',' read -r -a images <<< "${{ steps.gen-tags.outputs.fully-qualified-target-images }}"
|
||||
for image in "${images[@]}"; do
|
||||
docker buildx imagetools inspect ${image}
|
||||
done
|
||||
Loading…
Add table
Add a link
Reference in a new issue