Skip to content
This repository was archived by the owner on May 22, 2026. It is now read-only.

Merge pull request #1 from GreenMeteor/develop #57

Merge pull request #1 from GreenMeteor/develop

Merge pull request #1 from GreenMeteor/develop #57

Workflow file for this run

name: HumHub Docker CI/CD
on:
push:
branches: [ main, develop ]
tags: [ 'v*' ]
pull_request:
branches: [ main, develop ]
workflow_dispatch:
inputs:
deploy:
description: 'Deploy to production'
required: false
default: 'false'
type: choice
options:
- 'true'
- 'false'
env:
REGISTRY: docker.io
IMAGE_NAME: archblood/humhub
SHA: ${{ github.sha }}
jobs:
lint:
name: Lint Files
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: hadolint/hadolint-action@v3.1.0
with:
dockerfile: humhub/Dockerfile
failure-threshold: error
- uses: ibiqlik/action-yamllint@v3
with:
file_or_dir: .
strict: false
- uses: ludeeus/action-shellcheck@master
with:
scandir: './backup/scripts'
security-scan:
name: Security Scan
runs-on: ubuntu-latest
needs: lint
steps:
- uses: actions/checkout@v4
- uses: aquasecurity/trivy-action@master
with:
scan-type: 'fs'
ignore-unfixed: true
format: 'sarif'
output: 'trivy-results.sarif'
severity: 'CRITICAL,HIGH'
- uses: github/codeql-action/upload-sarif@v3
if: always()
with:
sarif_file: 'trivy-results.sarif'
build:
name: Build and Test
runs-on: ubuntu-latest
needs: [lint, security-scan]
steps:
- uses: actions/checkout@v4
- name: Set up required script files
run: bash .github/scripts/generate-build-context.sh
docker-build:
name: Build Docker Images
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set image tags
id: tags
run: |
BRANCH="${GITHUB_REF##*/}"
TAGS="${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${BRANCH},${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${GITHUB_SHA}"
NGINX_TAGS="${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-nginx:${BRANCH},${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-nginx:${GITHUB_SHA}"
BACKUP_TAGS="${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-backup:${BRANCH},${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-backup:${GITHUB_SHA}"
if [ "$BRANCH" = "main" ]; then
TAGS="$TAGS,${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest"
NGINX_TAGS="$NGINX_TAGS,${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-nginx:latest"
BACKUP_TAGS="$BACKUP_TAGS,${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-backup:latest"
fi
echo "tags=$TAGS" >> $GITHUB_OUTPUT
echo "nginx_tags=$NGINX_TAGS" >> $GITHUB_OUTPUT
echo "backup_tags=$BACKUP_TAGS" >> $GITHUB_OUTPUT
- uses: docker/build-push-action@v4
with:
context: humhub
push: true
tags: ${{ steps.tags.outputs.tags }}
- uses: docker/build-push-action@v4
with:
context: nginx
push: true
tags: ${{ steps.tags.outputs.nginx_tags }}
- uses: docker/build-push-action@v4
with:
context: backup
push: true
tags: ${{ steps.tags.outputs.backup_tags }}