Update Blackfire extension (#574) #570
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: Deploy Docker images | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- '*' # On all tags | |
jobs: | |
matrix: | |
name: Find layers | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Get the version | |
id: get-version | |
run: | | |
REF=${GITHUB_REF#refs/tags/} | |
if [[ $REF == *"refs"* ]]; then | |
REF="" | |
fi | |
echo ::set-output name=VERSION::$REF | |
# Only find layers that have changed since last tag OR if tag then get all | |
- id: find-layers | |
run: | | |
if [ "${{ steps.get-version.outputs.VERSION }}" = "" ]; then | |
git fetch --prune --unshallow | |
echo "::set-output name=list::$(git diff --name-only HEAD $(git describe --tags --abbrev=0) | grep layers/ | cut -d / -f 2 | sort | uniq | jq -R -s -c 'split("\n")[:-1]')" | |
else | |
echo "::set-output name=list::$(ls layers | jq -R -s -c 'split("\n")[:-1]')" | |
fi | |
outputs: | |
# Make the outputs accessible outside this job | |
list: ${{ steps.find-layers.outputs.list }} | |
version: ${{ steps.get-version.outputs.VERSION }} | |
publish: | |
needs: matrix | |
name: Deploy images | |
runs-on: ubuntu-latest | |
env: | |
DOCKER_BUILDKIT: '1' | |
strategy: | |
fail-fast: false | |
matrix: | |
layer: ${{ fromJson(needs.matrix.outputs.list) }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 2 | |
- name: Set up PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 7.4 | |
coverage: none | |
- name: Docker login | |
run: echo '${{ secrets.DOCKER_PASSWORD }}' | docker login --username ${{ secrets.DOCKER_USERNAME }} --password-stdin | |
- name: Build images | |
run: layer=${{ matrix.layer }} make docker-images | |
- name: Test images | |
run: layer=${{ matrix.layer }} make test | |
- name: Publish | |
env: | |
DOCKER_TAG: ${{ needs.matrix.outputs.version }} | |
run: layer=${{ matrix.layer }} make publish-docker-images | |
update: | |
needs: [matrix, publish] | |
name: Update tags | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 7.4 | |
coverage: none | |
- name: Update tags | |
run: ./new-docker-tags.php ${{ needs.matrix.outputs.version }} --update | |
if: ${{ needs.matrix.outputs.version != '' }} | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v3 | |
if: ${{ needs.matrix.outputs.version != '' }} | |
with: | |
token: ${{ secrets.BOT_GITHUB_TOKEN }} | |
base: master | |
branch: tag-update | |
author: Bref Bot <[email protected]> | |
committer: Bref Bot <[email protected]> | |
commit-message: Adding tag ${{ needs.matrix.outputs.version }} | |
title: Update list of tags | |
body: | | |
Since we just tagged ${{ needs.matrix.outputs.version }} we also need to update config.json |