2022-06-09 13:27:39 +03:00
|
|
|
### This workflow setup instance then build and push images ###
|
2022-07-11 13:27:43 +03:00
|
|
|
name: 4testing multiarch-build
|
2022-06-09 13:27:39 +03:00
|
|
|
|
|
|
|
on:
|
2022-09-16 12:28:44 +03:00
|
|
|
workflow_dispatch:
|
|
|
|
inputs:
|
|
|
|
build:
|
|
|
|
description: 'Build number (ex. 45)'
|
|
|
|
type: string
|
|
|
|
required: true
|
|
|
|
amd64:
|
|
|
|
type: boolean
|
|
|
|
description: 'Build AMD64'
|
|
|
|
default: true
|
|
|
|
arm64:
|
|
|
|
type: boolean
|
|
|
|
description: 'Build ARM64'
|
|
|
|
default: true
|
|
|
|
community:
|
|
|
|
type: boolean
|
|
|
|
description: 'Build Community Edition'
|
|
|
|
default: true
|
|
|
|
enterprise:
|
|
|
|
type: boolean
|
|
|
|
description: 'Build Enterprise Edition'
|
|
|
|
default: true
|
|
|
|
developer:
|
|
|
|
type: boolean
|
|
|
|
description: 'Build Developer Edition'
|
|
|
|
default: true
|
2022-06-09 13:27:39 +03:00
|
|
|
|
|
|
|
env:
|
|
|
|
COMPANY_NAME: "onlyoffice"
|
|
|
|
PRODUCT_NAME: "documentserver"
|
|
|
|
|
|
|
|
jobs:
|
2022-09-16 12:28:44 +03:00
|
|
|
prepare:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- id: matrix
|
|
|
|
run: |
|
|
|
|
set -ex
|
|
|
|
|
|
|
|
BRANCH_NAME=${GITHUB_REF#refs/heads/}
|
|
|
|
if ! [[ $BRANCH_NAME == develop || $BRANCH_NAME =~ hotfix || $BRANCH_NAME =~ release ]]; then
|
|
|
|
echo "Wrong branch."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
[ ${{ github.event.inputs.amd64 }} = true ] && PLATFORMS+=("amd64")
|
|
|
|
[ ${{ github.event.inputs.arm64 }} = true ] && PLATFORMS+=("arm64")
|
|
|
|
if [ -z ${PLATFORMS} ]; then
|
|
|
|
echo "None of the platforms are selected."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
[ ${{ github.event.inputs.community }} = true ] && EDITIONS+=("community")
|
|
|
|
[ ${{ github.event.inputs.enterprise }} = true ] && EDITIONS+=("enterprise")
|
|
|
|
[ ${{ github.event.inputs.developer }} = true ] && EDITIONS+=("developer")
|
|
|
|
if [ -z ${EDITIONS} ]; then
|
|
|
|
echo "None of the editions are selected."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
echo "::set-output name=editions::$(jq -n -c --arg s "${EDITIONS[*]}" '($s|split(" "))')"
|
|
|
|
outputs:
|
|
|
|
editions: ${{ steps.matrix.outputs.editions }}
|
|
|
|
|
2022-06-09 13:27:39 +03:00
|
|
|
build:
|
2022-09-16 12:28:44 +03:00
|
|
|
name: "Build ${{ matrix.image }}-${{ matrix.edition }}"
|
2022-06-09 13:27:39 +03:00
|
|
|
runs-on: ubuntu-latest
|
2022-09-16 12:28:44 +03:00
|
|
|
needs: prepare
|
2022-06-09 13:27:39 +03:00
|
|
|
strategy:
|
2022-08-30 14:33:23 +03:00
|
|
|
fail-fast: false
|
2022-06-09 13:27:39 +03:00
|
|
|
matrix:
|
2022-09-16 12:28:44 +03:00
|
|
|
image: ["documentserver"]
|
|
|
|
edition: ${{ fromJSON(needs.prepare.outputs.editions) }}
|
2022-06-09 13:27:39 +03:00
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: Set up QEMU
|
|
|
|
uses: docker/setup-qemu-action@v2
|
|
|
|
|
|
|
|
- name: Set up Docker Buildx
|
2022-07-21 18:44:06 +03:00
|
|
|
id: buildx
|
2022-06-09 13:27:39 +03:00
|
|
|
uses: docker/setup-buildx-action@v2
|
|
|
|
|
|
|
|
- name: Login to Docker Hub
|
2022-08-29 11:40:25 +03:00
|
|
|
uses: docker/login-action@v2
|
2022-06-09 13:27:39 +03:00
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
|
|
|
|
|
2022-07-11 13:27:43 +03:00
|
|
|
- name: Build 4testing
|
2022-06-09 13:27:39 +03:00
|
|
|
run: |
|
2022-09-16 12:28:44 +03:00
|
|
|
set -eux
|
|
|
|
|
2022-07-21 18:44:06 +03:00
|
|
|
### ==>> At this step build variable declaration ###
|
2022-09-16 12:28:44 +03:00
|
|
|
|
|
|
|
case ${{ matrix.edition }} in
|
|
|
|
community)
|
|
|
|
PRODUCT_EDITION=""
|
|
|
|
;;
|
|
|
|
enterprise)
|
|
|
|
PRODUCT_EDITION="-ee"
|
|
|
|
;;
|
|
|
|
developer)
|
|
|
|
PRODUCT_EDITION="-de"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
[ ${{ github.event.inputs.amd64 }} = true ] && PLATFORMS+=("amd64")
|
|
|
|
[ ${{ github.event.inputs.arm64 }} = true ] && PLATFORMS+=("arm64")
|
|
|
|
PLATFORM=$(echo ${PLATFORMS[*]/#/linux/} | tr ' ' ',')
|
|
|
|
|
|
|
|
BRANCH_NAME=${GITHUB_REF#refs/heads/}
|
|
|
|
if [ $BRANCH_NAME = develop ]; then
|
2022-12-01 14:46:31 +03:00
|
|
|
BUILD_CHANNEL=nightly
|
2022-09-16 12:28:44 +03:00
|
|
|
PRODUCT_VERSION=99.99.99
|
|
|
|
elif [[ $BRANCH_NAME =~ hotfix || $BRANCH_NAME =~ release ]]; then
|
2022-12-01 14:46:31 +03:00
|
|
|
BUILD_CHANNEL=test
|
2022-09-16 12:28:44 +03:00
|
|
|
PRODUCT_VERSION=${BRANCH_NAME#*/v}
|
2022-09-08 15:56:49 +03:00
|
|
|
fi
|
2022-09-16 12:28:44 +03:00
|
|
|
BUILD_NUMBER=${{ github.event.inputs.build }}
|
|
|
|
|
|
|
|
export PRODUCT_EDITION
|
2023-04-10 15:10:23 +03:00
|
|
|
export PACKAGE_VERSION=${PRODUCT_VERSION}-${BUILD_NUMBER}
|
2022-12-01 14:46:31 +03:00
|
|
|
export PACKAGE_BASEURL=${{ secrets.REPO_BASEURL }}/${BUILD_CHANNEL}
|
|
|
|
export BUILD_CHANNEL
|
2022-09-16 12:28:44 +03:00
|
|
|
export PLATFORM
|
|
|
|
export DOCKERFILE=Dockerfile
|
|
|
|
export PREFIX_NAME=4testing-
|
|
|
|
export TAG=${PRODUCT_VERSION}.${BUILD_NUMBER}
|
|
|
|
|
|
|
|
### ==>> Build and push images at this step ###
|
2022-09-08 15:56:49 +03:00
|
|
|
|
2022-09-16 12:28:44 +03:00
|
|
|
docker buildx bake -f docker-bake.hcl ${{ matrix.image }} --push
|
|
|
|
echo "DONE: Build success"
|
2022-06-09 13:27:39 +03:00
|
|
|
shell: bash
|