Push new images to Docker hub

Push the following new images to Docker hub:
- fpm
- fpm-alpine
- fpm-alpine-nginx
- fpm-alpine-nginx-composer
This commit is contained in:
Mohammed Al-Mahdawi 2021-04-07 21:15:28 +03:00
parent 2045207aeb
commit c19bbacafc
1 changed files with 47 additions and 11 deletions

View File

@ -1,4 +1,4 @@
name: Publish Docker image name: Publish Docker images
on: on:
schedule: schedule:
@ -11,23 +11,59 @@ on:
jobs: jobs:
docker: docker:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
strategy:
matrix:
image: ['', fpm, fpm-alpine, fpm-alpine-nginx, fpm-alpine-nginx-composer]
include:
- image: ''
file: Dockerfile
- image: fpm
file: fpm.Dockerfile
- image: fpm-alpine
file: fpm-alpine.Dockerfile
- image: fpm-alpine-nginx
file: fpm-alpine-nginx.Dockerfile
- image: fpm-alpine-nginx-composer
file: fpm-alpine-nginx-composer.Dockerfile
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Define tags - name: Define tag name
id: define-tags id: tag-name
run: | run: |
if [ "${GITHUB_REF}" == "refs/heads/master" -a "${GITHUB_EVENT_NAME}" != "pull_request" ]; then if [ "${GITHUB_REF}" == "refs/heads/master" -a "${GITHUB_EVENT_NAME}" != "pull_request" ]; then
curl -s https://api.github.com/repos/akaunting/akaunting/releases/latest \ curl -s https://api.github.com/repos/akaunting/akaunting/releases/latest \
| jq -r .tag_name | sed \ | jq -r .tag_name | sed \
-e 's/\(\(\([0-9]\+\)\.[0-9]\+\)\.[0-9]\+\)/\1,\2,\3,/' \ -e 's/^/::set-output name=tag::/'
-e 's/\([^,]\+\),/akaunting\/akaunting:\1,/g' \
-e 's/^/::set-output name=tags::/' \
-e 's/$/akaunting\/akaunting:latest/'
else else
echo -n "::set-output name=tags::akaunting/akaunting:" echo -n "::set-output name=tag::"
echo "$GITHUB_REF" | cut -d/ -f3- | tr '/' '_' echo "$GITHUB_REF" | cut -d/ -f3- | tr '/' '_'
fi fi
- name: Define images tags
id: image-tags
run: |
if [ "${GITHUB_REF}" == "refs/heads/master" -a "${GITHUB_EVENT_NAME}" != "pull_request" ]; then
if [ -z ${{ matrix.image }} ]; then
echo ${{ steps.tag-name.outputs.tag }} | sed \
-e 's/\(\(\([0-9]\+\)\.[0-9]\+\)\.[0-9]\+\)/\1,\2,\3,/' \
-e 's/\([^,]\+\),/akaunting\/akaunting:\1,/g' \
-e 's/^/::set-output name=tags::/' \
-e 's/$/akaunting\/akaunting:latest/'
else
echo ${{ steps.tag-name.outputs.tag }} | sed \
-e 's/\(\(\([0-9]\+\)\.[0-9]\+\)\.[0-9]\+\)/\1-${{ matrix.image }},\2-${{ matrix.image }},\3-${{ matrix.image }},/' \
-e 's/\([^,]\+\),/akaunting\/akaunting:\1,/g' \
-e 's/^/::set-output name=tags::/'
fi
else
if [ -z ${{ matrix.image }} ]; then
echo -n "::set-output name=tags::akaunting/akaunting:"
echo "$GITHUB_REF" | cut -d/ -f3- | tr '/' '_'
else
echo -n "::set-output name=tags::akaunting/akaunting:"
echo "$(echo "$GITHUB_REF" | cut -d/ -f3- | tr '/' '_')-${{ matrix.image }}"
fi
fi
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v1 uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx - name: Set up Docker Buildx
@ -38,11 +74,11 @@ jobs:
with: with:
username: ${{ secrets.DOCKERHUB_USERNAME }} username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push - name: Build and push images
uses: docker/build-push-action@v2 uses: docker/build-push-action@v2
with: with:
context: . context: .
file: ./Dockerfile file: ./${{ matrix.file }}
platforms: linux/amd64,linux/arm/v6,linux/arm64 platforms: linux/amd64,linux/arm/v6,linux/arm64
push: ${{ github.event_name != 'pull_request' }} push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.define-tags.outputs.tags }} tags: ${{ steps.image-tags.outputs.tags }}