Tag with versions #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tag with versions | |
on: | |
workflow_dispatch: | |
branches: [ 8.4 ] | |
schedule: | |
- cron: '0 10 * * WED' | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
tag: | |
name: Tag images | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
strategy: | |
matrix: | |
php_version: | |
- 8.4 | |
- 8.3 | |
- 8.2 | |
steps: | |
- name: Get 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 | |
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 }} | |