2022-06-09 12:27:39 +02:00
|
|
|
### This workflow setup instance then build and push images ###
|
2022-07-11 12:27:43 +02:00
|
|
|
name: 4testing multiarch-build
|
2023-11-20 10:05:00 +01:00
|
|
|
run-name: >-
|
|
|
|
Build #${{ inputs.build }} [
|
|
|
|
${{ inputs.amd64 && 'AMD64' || '-' }}
|
|
|
|
${{ inputs.arm64 && 'ARM64' || '-' }}
|
|
|
|
] [
|
|
|
|
${{ inputs.community && 'CE' || '-' }}
|
|
|
|
${{ inputs.developer && 'DE' || '-' }}
|
|
|
|
${{ inputs.enterprise && 'EE' || '-' }}
|
|
|
|
]
|
2022-06-09 12:27:39 +02:00
|
|
|
|
|
|
|
on:
|
2022-09-16 11:28:44 +02: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 12:27:39 +02:00
|
|
|
|
|
|
|
env:
|
|
|
|
COMPANY_NAME: "onlyoffice"
|
|
|
|
PRODUCT_NAME: "documentserver"
|
|
|
|
|
|
|
|
jobs:
|
2022-09-16 11:28:44 +02: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
|
2023-05-24 10:51:14 +02:00
|
|
|
echo "editions=$(jq -n -c --arg s "${EDITIONS[*]}" '($s|split(" "))')" >> $GITHUB_OUTPUT
|
2022-09-16 11:28:44 +02:00
|
|
|
outputs:
|
|
|
|
editions: ${{ steps.matrix.outputs.editions }}
|
|
|
|
|
2022-06-09 12:27:39 +02:00
|
|
|
build:
|
2022-09-16 11:28:44 +02:00
|
|
|
name: "Build ${{ matrix.image }}-${{ matrix.edition }}"
|
2022-06-09 12:27:39 +02:00
|
|
|
runs-on: ubuntu-latest
|
2022-09-16 11:28:44 +02:00
|
|
|
needs: prepare
|
2022-06-09 12:27:39 +02:00
|
|
|
strategy:
|
2022-08-30 13:33:23 +02:00
|
|
|
fail-fast: false
|
2022-06-09 12:27:39 +02:00
|
|
|
matrix:
|
2022-09-16 11:28:44 +02:00
|
|
|
image: ["documentserver"]
|
|
|
|
edition: ${{ fromJSON(needs.prepare.outputs.editions) }}
|
2022-06-09 12:27:39 +02: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 17:44:06 +02:00
|
|
|
id: buildx
|
2022-06-09 12:27:39 +02:00
|
|
|
uses: docker/setup-buildx-action@v2
|
|
|
|
|
|
|
|
- name: Login to Docker Hub
|
2022-08-29 10:40:25 +02:00
|
|
|
uses: docker/login-action@v2
|
2022-06-09 12:27:39 +02:00
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
|
|
|
|
|
2022-07-11 12:27:43 +02:00
|
|
|
- name: Build 4testing
|
2022-06-09 12:27:39 +02:00
|
|
|
run: |
|
2022-09-16 11:28:44 +02:00
|
|
|
set -eux
|
|
|
|
|
2022-07-21 17:44:06 +02:00
|
|
|
### ==>> At this step build variable declaration ###
|
2022-09-16 11:28:44 +02: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 12:46:31 +01:00
|
|
|
BUILD_CHANNEL=nightly
|
2022-09-16 11:28:44 +02:00
|
|
|
PRODUCT_VERSION=99.99.99
|
|
|
|
elif [[ $BRANCH_NAME =~ hotfix || $BRANCH_NAME =~ release ]]; then
|
2022-12-01 12:46:31 +01:00
|
|
|
BUILD_CHANNEL=test
|
2022-09-16 11:28:44 +02:00
|
|
|
PRODUCT_VERSION=${BRANCH_NAME#*/v}
|
2022-09-08 14:56:49 +02:00
|
|
|
fi
|
2022-09-16 11:28:44 +02:00
|
|
|
BUILD_NUMBER=${{ github.event.inputs.build }}
|
|
|
|
|
|
|
|
export PRODUCT_EDITION
|
2023-04-10 14:10:23 +02:00
|
|
|
export PACKAGE_VERSION=${PRODUCT_VERSION}-${BUILD_NUMBER}
|
2023-04-14 19:32:04 +02:00
|
|
|
export PACKAGE_BASEURL=${{ secrets.REPO_BASEURL }}
|
2022-12-01 12:46:31 +01:00
|
|
|
export BUILD_CHANNEL
|
2022-09-16 11:28:44 +02: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 14:56:49 +02:00
|
|
|
|
2022-09-16 11:28:44 +02:00
|
|
|
docker buildx bake -f docker-bake.hcl ${{ matrix.image }} --push
|
|
|
|
echo "DONE: Build success"
|
2022-06-09 12:27:39 +02:00
|
|
|
shell: bash
|