-
Notifications
You must be signed in to change notification settings - Fork 9
105 lines (101 loc) · 3.81 KB
/
ongoing-branch.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
name: Update Docker image for ongoing branches
on:
schedule:
- cron: "0 */12 * * *"
repository_dispatch:
types:
- build-ongoing
jobs:
generate_matrix:
name: Generate matrix
runs-on: ubuntu-latest
outputs:
generated-matrix: ${{ steps.generate-matrix.outputs.generated-matrix }}
steps:
-
name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
extensions: none
tools: none
coverage: none
-
name: Checkout
uses: actions/checkout@v4
-
name: Generate matrix
id: generate-matrix
run: ./.github/workflows/generate-matrix ongoing-branch.yml "$GITHUB_OUTPUT"
build:
name: Build ${{ matrix.data.image_tag }}
runs-on: ubuntu-latest
needs:
- generate_matrix
strategy:
matrix:
data: ${{ fromJSON(needs.generate_matrix.outputs.generated-matrix) }}
steps:
-
name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
-
name: Check if build is needed
id: check
run: ./.github/workflows/ongoing-branch-check ${{ matrix.data.repo_branch }} ${{ matrix.data.c5_startingpoint }}
-
name: Fetch base Docker image
if: steps.check.outputs.BUILD_SHA1
run: docker pull ghcr.io/concrete5-community/docker5:base
-
name: Build with starting point ${{ matrix.data.c5_startingpoint }}
if: steps.check.outputs.BUILD_SHA1
run: |
docker build \
--build-arg CCM_PHP_VERSION=${{ matrix.data.php_version }} \
--build-arg CCM_COMPOSER_VERSION=${{ matrix.data.composer_version }} \
--build-arg CCM_PHPUNIT_VERSION=${{ matrix.data.phpunit_version }} \
--build-arg CCM_C5_ARCHIVE=https://codeload.github.com/concretecms/concretecms/tar.gz/${{ steps.check.outputs.BUILD_SHA1 }} \
--build-arg CCM_STARTING_POINT=${{ matrix.data.c5_startingpoint }} \
--build-arg CCM_PATCH_ENVIRONMENT_ONLY=${{ matrix.data.patch_environment_only }} \
--tag ghcr.io/concrete5-community/docker5:${{ matrix.data.image_tag }} \
./installed
for additional_tag in ${{ matrix.data.additional_tags }}; do
docker tag ghcr.io/concrete5-community/docker5:${{ matrix.data.image_tag }} ghcr.io/concrete5-community/docker5:$additional_tag
done
-
name: Check that MariaDB works
if: steps.check.outputs.BUILD_SHA1
run: docker run --rm --entrypoint='' ghcr.io/concrete5-community/docker5:${{ matrix.data.image_tag }} ccm-service start db
-
name: Remove base Docker image
if: steps.check.outputs.BUILD_SHA1
run: docker rmi ghcr.io/concrete5-community/docker5:base || true
-
name: Login to the Docker container registry
if: steps.check.outputs.BUILD_SHA1
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Publish image
if: steps.check.outputs.BUILD_SHA1
run: docker push --all-tags ghcr.io/concrete5-community/docker5
-
name: Update repository
if: steps.check.outputs.BUILD_SHA1
env:
BUILT_SHA1: ${{ steps.check.outputs.BUILD_SHA1 }}
run: ./.github/workflows/ongoing-branch-updated ${{ matrix.data.repo_branch }} ${{ matrix.data.c5_startingpoint }}
-
name: Notify failures
if: failure()
uses: appleboy/telegram-action@master
with:
token: ${{ secrets.TELEGRAM_TOKEN }}
to: '-1001989057474'
message: Building ongoing branches failed on https://github.com/concrete5-community/docker5/actions/runs/${{ github.run_id }}