|
| 1 | +name: "GLPI Github Actions GLPI/Apache images" |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - "main" |
| 7 | + paths: |
| 8 | + - ".github/workflows/githubactions-glpi-apache.yml" |
| 9 | + - "githubactions-glpi-apache/**" |
| 10 | + pull_request: |
| 11 | + paths: |
| 12 | + - ".github/workflows/githubactions-glpi-apache.yml" |
| 13 | + - "githubactions-glpi-apache/**" |
| 14 | + schedule: |
| 15 | + - cron: '0 22 * * *' |
| 16 | + # Enable manual run |
| 17 | + workflow_dispatch: |
| 18 | + |
| 19 | +jobs: |
| 20 | + build: |
| 21 | + runs-on: "ubuntu-latest" |
| 22 | + strategy: |
| 23 | + fail-fast: false |
| 24 | + matrix: |
| 25 | + include: |
| 26 | + - {glpi-branch: "10.0/bugfixes", glpi-version: "10.0.x", php-version: "7.4"} |
| 27 | + - {glpi-branch: "10.0/bugfixes", glpi-version: "10.0.x", php-version: "8.0"} |
| 28 | + - {glpi-branch: "10.0/bugfixes", glpi-version: "10.0.x", php-version: "8.1"} |
| 29 | + - {glpi-branch: "10.0/bugfixes", glpi-version: "10.0.x", php-version: "8.2"} |
| 30 | + - {glpi-branch: "10.0/bugfixes", glpi-version: "10.0.x", php-version: "8.3"} |
| 31 | + - {glpi-branch: "main", glpi-version: "10.1.x", php-version: "8.1"} |
| 32 | + - {glpi-branch: "main", glpi-version: "10.1.x", php-version: "8.2"} |
| 33 | + - {glpi-branch: "main", glpi-version: "10.1.x", php-version: "8.3"} |
| 34 | + steps: |
| 35 | + - name: "Set variables" |
| 36 | + run: | |
| 37 | + OUTPUTS="type=image" |
| 38 | + if [[ "${{ github.ref }}" = 'refs/heads/main' && "${{ github.repository }}" = 'glpi-project/docker-images' ]]; then |
| 39 | + OUTPUTS="$OUTPUTS,push=true" |
| 40 | + fi |
| 41 | + echo "OUTPUTS=$OUTPUTS" >> $GITHUB_ENV |
| 42 | + - name: "Checkout" |
| 43 | + uses: "actions/checkout@v4" |
| 44 | + - name: "Set up Docker Buildx" |
| 45 | + uses: "docker/setup-buildx-action@v3" |
| 46 | + - name: "Login to DockerHub" |
| 47 | + uses: "docker/login-action@v3" |
| 48 | + with: |
| 49 | + username: "${{ secrets.DOCKER_HUB_USERNAME }}" |
| 50 | + password: "${{ secrets.DOCKER_HUB_TOKEN }}" |
| 51 | + - name: "Login to Github container registry" |
| 52 | + uses: "docker/login-action@v3" |
| 53 | + with: |
| 54 | + registry: "ghcr.io" |
| 55 | + username: "${{ secrets.GHCR_USERNAME }}" |
| 56 | + password: "${{ secrets.GHCR_ACCESS_TOKEN }}" |
| 57 | + - name: "Build and push" |
| 58 | + uses: "docker/build-push-action@v5" |
| 59 | + with: |
| 60 | + build-args: | |
| 61 | + BASE_IMAGE=ghcr.io/glpi-project/githubactions-php-apache:${{ matrix.php-version }} |
| 62 | + GLPI_BRANCH=${{ matrix.glpi-branch }} |
| 63 | + no-cache: true |
| 64 | + context: "githubactions-glpi-apache" |
| 65 | + outputs: "${{ env.OUTPUTS }}" |
| 66 | + pull: true |
| 67 | + tags: "ghcr.io/glpi-project/githubactions-glpi-apache:php-${{ matrix.php-version }}-glpi-${{ matrix.glpi-version }}" |
0 commit comments