Skip to content

feat(redis): add python-is-python3 #41

feat(redis): add python-is-python3

feat(redis): add python-is-python3 #41

Workflow file for this run

name: build apps
on:
workflow_dispatch:
workflow_run:
workflows: [build base]
types: [completed]
branches:
- master
push:
branches:
- master
paths:
- apps/**
- scripts/apps/**
permissions:
contents: read
packages: write
jobs:
check_changes:
runs-on: ubuntu-latest
outputs:
apps_json: ${{ steps.emit.outputs.apps_json }}
steps:
- if: ${{ github.event_name == 'push' }}
uses: actions/checkout@v4
with:
fetch-depth: 0
- if: ${{ github.event_name == 'push' }}
id: filter
uses: dorny/paths-filter@v3
with:
filters: |
postgresql_changed:
- 'apps/postgresql/**'
- 'scripts/apps/postgresql/**'
uptime_kuma_2_changed:
- 'apps/uptime-kuma-2/**'
- 'scripts/apps/uptime-kuma-2/**'
sinusbot_changed:
- 'apps/sinusbot/**'
redis_changed:
- 'apps/redis/**'
- 'scripts/apps/redis/**'
base_changed:
- 'base/**'
- 'scripts/base/ampstart.sh'
- id: emit
shell: bash
run: |
set -euo pipefail
# Default matrix when not a push: build all apps
if [ "${{ github.event_name }}" != "push" ]; then
echo 'apps_json=["postgresql","uptime-kuma-2","sinusbot","redis"]' >> "$GITHUB_OUTPUT"
exit 0
fi
# On push: if base changed, build nothing (let base workflow handle rebuilds)
if [ "${{ steps.filter.outputs.base_changed || 'false' }}" = "true" ]; then
echo 'apps_json=[]' >> "$GITHUB_OUTPUT"
exit 0
fi
apps=()
if [ "${{ steps.filter.outputs.postgresql_changed || 'false' }}" = "true" ]; then apps+=('"postgresql"'); fi
if [ "${{ steps.filter.outputs.uptime_kuma_2_changed || 'false' }}" = "true" ]; then apps+=('"uptime-kuma-2"'); fi
if [ "${{ steps.filter.outputs.sinusbot_changed || 'false' }}" = "true" ]; then apps+=('"sinusbot"'); fi
if [ "${{ steps.filter.outputs.redis_changed || 'false' }}" = "true" ]; then apps+=('"redis"'); fi
if [ "${#apps[@]}" -eq 0 ]; then
echo 'apps_json=[]' >> "$GITHUB_OUTPUT"
else
printf 'apps_json=[%s]\n' "$(IFS=,; echo "${apps[*]}")" >> "$GITHUB_OUTPUT"
fi
build_and_push:
needs: [check_changes]
if: ${{ github.repository_owner == 'CubeCoders' && github.ref == 'refs/heads/master' && (github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success') && needs.check_changes.outputs.apps_json != '[]' }}
name: 'ampbase:${{ matrix.app }}'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
app: ${{ fromJSON(needs.check_changes.outputs.apps_json) }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_sha || github.sha }}
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- run: docker buildx prune -af
- uses: docker/build-push-action@v6
with:
context: .
file: ./apps/${{ matrix.app }}/Dockerfile
platforms: ${{ matrix.app == 'sinusbot' && 'linux/amd64' || 'linux/amd64,linux/arm64/v8' }}
push: true
pull: true
tags: cubecoders/ampbase:${{ matrix.app }}
cache-from: type=gha,scope=${{ github.workflow }}-${{ matrix.app }}
cache-to: type=gha,mode=max,scope=${{ github.workflow }}-${{ matrix.app }}
provenance: mode=max
sbom: true
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false