Skip to content

Github actions nightly images #247

Github actions nightly images

Github actions nightly images #247

Workflow file for this run

name: "Github actions nightly images"
on:
push:
branches:
- "main"
paths:
- ".github/workflows/glpi-nightly.yml"
- "glpi-nightly/**"
pull_request:
paths:
- ".github/workflows/glpi-nightly.yml"
- "glpi-nightly/**"
schedule:
- cron: '0 0 * * 1'
# Enable manual run
workflow_dispatch:
jobs:
build:
name: "Build ${{ matrix.branch }} on PHP ${{ matrix.php-version }}"
runs-on: "ubuntu-latest"
strategy:
fail-fast: false
matrix:
include:
- {php-version: "8.2", branch: "main"}
- {php-version: "8.1", branch: "10.0/bugfixes"}
steps:
- name: "Set variables"
run: |
OUTPUTS="type=image"
if [[ "${{ github.ref }}" = 'refs/heads/main' && "${{ github.repository }}" = 'glpi-project/docker-images' ]]; then
OUTPUTS="$OUTPUTS,push=true"
fi
echo "OUTPUTS=$OUTPUTS" >> $GITHUB_ENV
IMAGE_VERSION=$(echo ${{ matrix.branch }} | sed -E 's|/|-|')
echo "IMAGE_TAG=ghcr.io/glpi-project/glpi-nightly:$IMAGE_VERSION" >> $GITHUB_ENV
- name: "Checkout"
uses: "actions/checkout@v4"
- name: "Get sources from glpi-project/glpi"
run: |
curl https://github.com/glpi-project/glpi/archive/${{ matrix.branch }}.tar.gz --location --output glpi.tar.gz
mkdir glpi-nightly/sources
tar --extract --ungzip --strip 1 --file glpi.tar.gz --directory glpi-nightly/sources
- name: "Set up Docker Buildx"
uses: "docker/setup-buildx-action@v3"
- name: "Login to DockerHub"
uses: "docker/login-action@v3"
with:
username: "${{ secrets.DOCKER_HUB_USERNAME }}"
password: "${{ secrets.DOCKER_HUB_TOKEN }}"
- name: "Login to Github container registry"
uses: "docker/login-action@v3"
with:
registry: "ghcr.io"
username: "${{ secrets.GHCR_USERNAME }}"
password: "${{ secrets.GHCR_ACCESS_TOKEN }}"
- name: "Build and push"
uses: "docker/build-push-action@v5"
with:
build-args: |
BUILDER_IMAGE=php:${{ matrix.php-version }}-cli-alpine
APP_IMAGE=php:${{ matrix.php-version }}-apache
cache-from: "type=gha"
cache-to: "type=gha,mode=max"
context: "glpi-nightly"
outputs: "${{ env.OUTPUTS }}"
pull: true
tags: "${{ env.IMAGE_TAG }}"