-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (43 loc) · 1.41 KB
/
tag-versions.yaml
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
name: Tag w/ PHP versions
on:
workflow_dispatch:
branches: [ 8.4, 8.3, 8.2 ]
schedule:
- cron: '0 10 * * WED'
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
tag:
name: Tag images with PHP versions
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
matrix:
php_version:
- 8.4
- 8.3
- 8.2
steps:
- name: Get PHP version
id: php_version
env:
PHP_VERSION: ${{ matrix.php_version }}
IMAGE: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.php_version }}
run: |
echo "actual_version=$(docker run --rm --entrypoint sh ${IMAGE} -c 'php -v | head -n 1 | cut -d " " -f 2')" >> "$GITHUB_OUTPUT"
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Tag and push
env:
IMAGE: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.php_version }}
ACTUAL_VERSION: ${{ steps.php_version.outputs.actual_version }}
run: |
docker image tag ${{ env.IMAGE }} ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.ACTUAL_VERSION }}
docker image push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.ACTUAL_VERSION }}