mirror of
https://github.com/chevereto/chevereto.git
synced 2026-01-17 04:42:07 +01:00
119 lines
3.8 KiB
YAML
119 lines
3.8 KiB
YAML
name: Docker
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "*"
|
|
|
|
env:
|
|
GHCR_SLUG: ghcr.io/${{ github.repository }}
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-22.04]
|
|
php: ["8.1"]
|
|
env:
|
|
tools: composer
|
|
ini-values: default_charset='UTF-8'
|
|
name: Build on PHP ${{ matrix.php }} ${{ matrix.os }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Get current branch
|
|
id: get-branch
|
|
run: |
|
|
raw=$(git branch -r --contains ${{ github.ref }})
|
|
echo "branch=${raw##*/}" >> $GITHUB_OUTPUT
|
|
- run: echo ${{ steps.get-branch.outputs.branch }}
|
|
- name: Setup PHP
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: ${{ matrix.php }}
|
|
ini-values: ${{ env.ini-values }}
|
|
tools: ${{ env.tools }}
|
|
env:
|
|
fail-fast: true
|
|
- name: Docker meta
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: |
|
|
chevereto/chevereto
|
|
${{ env.GHCR_SLUG }}
|
|
tags: |
|
|
type=raw,value=latest,enable={{is_default_branch}}
|
|
type=semver,pattern={{version}}
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
type=semver,pattern={{major}}
|
|
labels: |
|
|
org.opencontainers.image.title=Chevereto V4
|
|
org.opencontainers.image.description=Ultimate image and video sharing software
|
|
org.opencontainers.image.vendor=Chevereto
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
- name: Login to GHCR
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.repository_owner }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
- name: Build dependencies
|
|
run: composer install --no-progress
|
|
working-directory: app
|
|
- name: Build Chevereto
|
|
run: |
|
|
app/bin/legacy -C langs
|
|
app/bin/legacy -C htaccess-checksum
|
|
app/bin/legacy -C htaccess-enforce
|
|
- name: Packaging
|
|
run: |
|
|
rm -rf .git .gitignore .github .ecs .vscode
|
|
rm -rf README.md chevereto.svg rector.php
|
|
rm -rf app/tests app/phpunit*.xml
|
|
rm -rf app/.editions app/bin/edition
|
|
mkdir images/_assets
|
|
mkdir importing/{parse-users,parse-albums,no-parse}
|
|
mv .package ..
|
|
ls -la ../.package
|
|
- name: Checkout chevereto/docker
|
|
uses: actions/checkout@v3
|
|
with:
|
|
repository: chevereto/docker
|
|
path: docker
|
|
ref: ${{ steps.get-branch.outputs.branch }}
|
|
- run: |
|
|
mv docker ../docker
|
|
mkdir -p ../docker/chevereto
|
|
ls -la ../docker
|
|
- name: Copy to docker folder
|
|
run: |
|
|
cp -a ./. ../docker/chevereto/
|
|
ls -la ../docker/chevereto
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: ../docker
|
|
platforms: linux/amd64,linux/arm64
|
|
push: true
|
|
provenance: false
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
- name: Check manifest
|
|
run: docker buildx imagetools inspect ${{ env.GHCR_SLUG }}:${{ steps.meta.outputs.version }}
|
|
- name: Inspect image
|
|
run: |
|
|
docker pull ${{ env.GHCR_SLUG }}:${{ steps.meta.outputs.version }}
|
|
docker image inspect ${{ env.GHCR_SLUG }}:${{ steps.meta.outputs.version }}
|