name: Build containers on: workflow_dispatch: push: branches: ["main"] paths: ["containers/**", ".gitea/workflows/build.yaml"] pull_request: branches: ["main"] paths: ["containers/**", ".gitea/workflows/build.yaml"] schedule: - cron: "0 16 * * FRI" env: REGISTRY: git.plabble.org # Images in build order; later images build FROM the local base image. IMAGES: base web TAG: ${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.number) || github.ref_name }} PUSH: ${{ github.event_name != 'pull_request' }} CONTAINER_HOST: unix:///var/run/docker.sock jobs: build: runs-on: podman-test steps: - run: dnf install -yq git-core podman-remote - uses: builtin:checkout - name: Build run: | for image in $IMAGES; do pull=never; [[ $image == base ]] && pull=newer podman-remote build --pull="$pull" \ --build-arg TAG="$TAG" \ -t "$REGISTRY/job79/$image:$TAG" "containers/$image" done - name: Push if: env.PUSH == 'true' env: REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }} REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }} run: | podman-remote login -u "$REGISTRY_USERNAME" --password-stdin "$REGISTRY" <<<"$REGISTRY_TOKEN" for image in $IMAGES; do podman-remote push --compression-format=zstd:chunked --compression-level=12 "$REGISTRY/job79/$image:$TAG" done