small refactor

This commit is contained in:
Alexander
2023-08-28 22:11:26 +02:00
parent 05dfb923b3
commit 10bea305cf
6 changed files with 116 additions and 113 deletions
-90
View File
@@ -1,90 +0,0 @@
name: CI
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]
schedule:
- cron: "23 1 2 * *"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build-gearman:
name: Build, test and publish - ${{ matrix.release_image_version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
base_image_version: [ '5.2-fpm-alpine', 'fpm-alpine' ]
include:
- base_image_version: '5.2-fpm-alpine'
release_image_version: '5.2'
- base_image_version: 'fpm-alpine'
release_image_version: 'latest'
steps:
- name: Prepare env variables
run: |
echo "BUILD_DATE=$(TZ=':UTC' date +'%Y-%m-%d %H:%M:%S (%Z)')" >> ${GITHUB_ENV}
echo "BUILD_FINGERPRINT=${GITHUB_SHA::7}" >> ${GITHUB_ENV}
- name: Check out code
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GH_TOKEN }}
- name: Build images and push to registry
uses: docker/build-push-action@v4
with:
platforms: linux/amd64
cache-from: type=gha, scope=${{ github.workflow }}-${{ matrix.version }}
cache-to: type=gha, scope=${{ github.workflow }}-${{ matrix.version }}, mode=max
context: .
file: ./docker/Dockerfile
build-args: |
BUILD_DATE=${{ env.BUILD_DATE }}
BUILD_FINGERPRINT=${{ env.BUILD_FINGERPRINT }}
BASE_IMAGE_VERSION=${{ matrix.base_image_version }}
IMAGE_TAG=${{ matrix.release_image_version }}
tags: |
beeyev/phpmyadmin-lightweight:${{ matrix.release_image_version }}
ghcr.io/beeyev/phpmyadmin-docker-lightweight:${{ matrix.release_image_version }}
pull: true
push: true
Update-Docker-Hub-repo-description:
name: Update Docker Hub repo description
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Update Docker Hub repo description
uses: peter-evans/dockerhub-description@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
repository: beeyev/phpmyadmin-lightweight
#short-description: ${{ github.event.repository.description }}
@@ -0,0 +1,50 @@
# Alexander Tebiev - https://github.com/beeyev
name: Build Production Docker Images
on:
push:
branches: [ master ]
schedule:
- cron: "23 1 2 * *"
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
docker-image-deploy:
strategy:
fail-fast: false
matrix:
SOURCE_IMAGE_VERSION: [ '5.2-fpm-alpine' ]
TARGET_IMAGE_VERSION: [ '5.2' ]
uses: ./.github/workflows/callable-build-docker-image.yml
name: Build Production Docker Images / ${{ matrix.SOURCE_IMAGE_VERSION }}-${{ matrix.TARGET_IMAGE_VERSION }}
with:
BASE_IMAGE_VERSION: ${{ matrix.SOURCE_IMAGE_VERSION }}
DOCKER_REGISTRY_IMAGE: |
beeyev/phpmyadmin-lightweight:latest
beeyev/phpmyadmin-lightweight:${{ matrix.TARGET_IMAGE_VERSION }}
ghcr.io/beeyev/phpmyadmin-docker-lightweight:latest
ghcr.io/beeyev/phpmyadmin-docker-lightweight:${{ matrix.TARGET_IMAGE_VERSION }}
DOCKERFILE_PATH: ./docker/Dockerfile
secrets: inherit
update-docker-hub-repo-description:
name: Update Docker Hub repo description
runs-on: ubuntu-latest
needs: docker-image-deploy
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Update Docker Hub repo description
uses: peter-evans/dockerhub-description@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
repository: beeyev/phpmyadmin-lightweight
#short-description: ${{ github.event.repository.description }}
@@ -22,11 +22,6 @@ jobs:
# (github.event.action == 'labeled' && github.event.label.name == 'make-test-build') ||
# (github.event.action == 'synchronize' && contains(github.event.pull_request.labels.*.name, 'make-test-build'))
steps:
- name: Remove `test-build` label
uses: actions-ecosystem/action-remove-labels@v1
with:
labels: make-test-build
- name: Sticky Pull Request Comment
uses: marocchino/sticky-pull-request-comment@v2
with:
@@ -34,10 +29,28 @@ jobs:
> [Building test docker images...](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})
docker-image-deploy:
strategy:
fail-fast: false
matrix:
SOURCE_IMAGE_VERSION: [ '5.2-fpm-alpine' ]
TARGET_IMAGE_VERSION: [ 'test' ]
uses: ./.github/workflows/callable-build-docker-image.yml
name: Build Test Docker Images / ${{ matrix.baseDist }}-test
if: contains(github.event.label.name, 'make-test-build')
with:
BASE_IMAGE_VERSION: 5.2-fpm-alpine
DOCKER_REGISTRY_IMAGE: ghcr.io/beeyev/phpmyadmin-docker-lightweight:test
BASE_IMAGE_VERSION: ${{ matrix.SOURCE_IMAGE_VERSION }}
DOCKER_REGISTRY_IMAGE: ghcr.io/beeyev/phpmyadmin-docker-lightweight:${{ matrix.TARGET_IMAGE_VERSION }}
DOCKERFILE_PATH: ./docker/Dockerfile
secrets: inherit
finalize:
name: Finalize
runs-on: ubuntu-latest
permissions:
pull-requests: write
needs: docker-image-deploy
steps:
- name: Remove `test-build` label
uses: actions-ecosystem/action-remove-labels@v1
with:
labels: make-test-build