Docker-DocumentServer/.github/workflows/stable-build.yml
Danil Titarenko 207bd5dac7
Add build Documentserver without example (#473)
* Add dockerfile for non-example build

* Create new symlink for supervisor config

* Add ARG for dynamic images specification

* Update action version

* Add build nonexample after stable build success

* Add targets for nonexample build

* Cosmetic changes

* Update FROM instruction

* Add default tag

* Remove needless welcome nginx location

* Change nonexample image tags

* Set correct nonexample image tag

* Change tag for nonexample image

* Change dockerfile name

* Rename dockerfile for release images

* Move stable build to dockerfile

* Refactoring bake file
2022-08-29 11:40:25 +03:00

111 lines
3.6 KiB
YAML

### This workflow setup instance then build and push images ###
name: Multi-arch build stable
on:
push:
tags:
- "v*-stable"
env:
COMPANY_NAME: "onlyoffice"
PRODUCT_NAME: "documentserver"
jobs:
build:
name: "Release image: DocumentServer${{ matrix.edition }}"
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.condition }}
strategy:
matrix:
images: ["documentserver-stable"]
edition: ["", "-ee", "-de"]
condition: [true]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Get Tag Name
id: tag_name
run: |
echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/}
- name: Build documentserver-release
run: |
TAG=$(echo ${{ steps.tag_name.outputs.SOURCE_TAG }} | sed 's/^.//; s/-stable//')
SHORTER_TAG=$(echo ${TAG} | grep -o -P '^[\d]+\.[\d]+\.[\d]+')
SHORTEST_TAG=$(echo ${TAG} | grep -o -P '^[\d]+\.[\d]+')
IMAGE_STATUS=$(docker manifest inspect ${{ env.COMPANY_NAME }}/4testing-${{ env.PRODUCT_NAME }}${{ matrix.edition }}:$TAG > /dev/null ; echo $?)
if [[ "$IMAGE_STATUS" = "0" ]]; then
echo "Image present on docker.hub >> start build stable version"
PRODUCT_EDITION=${{ matrix.edition }} \
PRODUCT_NAME=${{ env.PRODUCT_NAME }} \
COMPANY_NAME=${{ env.COMPANY_NAME}} \
TAG=$TAG \
SHORTER_TAG=$SHORTER_TAG \
SHORTEST_TAG=$SHORTEST_TAG \
docker buildx bake \
-f docker-bake.hcl ${{ matrix.images }} \
--push
echo "DONE: Build success >> exit with 0"
exit 0
else
echo "FAILED: Image with tag $TAG do not presented on docker.hub >> build will not started >> exit with 1"
exit 1
fi
shell: bash
build-nonExample:
name: "Release image: DocumentServer${{ matrix.edition }}-nonExample"
runs-on: ubuntu-latest
needs: [build]
continue-on-error: ${{ matrix.condition }}
strategy:
matrix:
images: ["documentserver-nonexample"]
edition: ["", "-ee", "-de"]
condition: [true]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Get Tag Name
id: tag_name
run: |
echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/}
- name: build image
run: |
TAG=$(echo ${{ steps.tag_name.outputs.SOURCE_TAG }} | sed 's/^.//; s/-stable//')
PRODUCT_EDITION=${{ matrix.edition }} \
PRODUCT_NAME=${{ env.PRODUCT_NAME }} \
COMPANY_NAME=${{ env.COMPANY_NAME }} \
TAG=$TAG \
docker buildx bake \
-f docker-bake.hcl ${{ matrix.images }} \
--push
shell: bash