-
Notifications
You must be signed in to change notification settings - Fork 2
83 lines (71 loc) · 2.56 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
name: CI to Docker Hub
on:
push:
branches: [ main ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-22.04
strategy:
matrix:
mediawiki_version: ['1.42', '1.41', '1.40', '1.39']
php_version: ['8.2', '8.1']
target_repository: ['mediawiki', 'mediawiki-ci']
include:
# set global default php
- php_default: '8.1'
# set 1.35 default php
# - php_default: '7.4'
# mediawiki_version: '1.35'
exclude:
- php_version: '8.2'
mediawiki_version: '1.39'
steps:
- name: Checkout
uses: actions/checkout@v4
# Docker setup
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: network=host
- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache/${{ matrix.mediawiki_version }}/${{ matrix.database_type }}
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
# Env setup
- name: Retrieve MediaWiki version
run: |
source ./helpers.sh
echo "MEDIAWIKI_FULL_VERSION=$(mediawiki_version ${{matrix.mediawiki_version}})" >> $GITHUB_ENV
- name: generate tags for image
run: |
source ./helpers.sh
echo "TAGS=$(generate_tags gesinn/${{ matrix.target_repository }} ${{env.MEDIAWIKI_FULL_VERSION}} ${{matrix.mediawiki_version}} ${{matrix.php_version}} ${{matrix.php_default}})" >> $GITHUB_ENV
# Image build
- name: Build and push
id: docker_build
uses: docker/build-push-action@v6
with:
context: ./
file: ./Dockerfile
network: host
allow: network.host
build-args: |
MEDIAWIKI_VERSION=${{ env.MEDIAWIKI_FULL_VERSION }}
PHP_VERSION=${{ matrix.php_version }}
builder: ${{ steps.buildx.outputs.name }}
push: true
tags: ${{ env.TAGS }}
target: ${{ matrix.target_repository }}
cache-from: type=local,src=/tmp/.buildx-cache/${{ matrix.mediawiki_version }}/${{ matrix.database_type }}
cache-to: type=local,dest=/tmp/.buildx-cache/${{ matrix.mediawiki_version }}/${{ matrix.database_type }}
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}