Docker-DocumentServer/.github/workflows/4testing-build.yml

76 lines
2.8 KiB
YAML
Raw Normal View History

### This workflow setup instance then build and push images ###
2022-07-11 13:27:43 +03:00
name: 4testing multiarch-build
on:
push:
tags:
- "v*"
- "!v*-stable"
env:
COMPANY_NAME: "onlyoffice"
PRODUCT_NAME: "documentserver"
jobs:
build:
name: Build
runs-on: ubuntu-latest
2022-07-11 13:27:43 +03:00
continue-on-error: ${{ matrix.condition }}
strategy:
matrix:
images: ["documentserver"]
2022-07-11 13:27:43 +03:00
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@v1
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/}
2022-07-11 13:27:43 +03:00
- name: Build 4testing
run: |
DOCKER_TAG=$(echo ${{ steps.tag_name.outputs.SOURCE_TAG }} | sed 's/^.//' )
PACKAGE_VERSION=$(echo $DOCKER_TAG | sed 's/\./-/3')
PACKAGE_URL=${{ secrets.REPO_URL }}${{ matrix.edition }}_"$PACKAGE_VERSION"_amd64.deb
STATUS=$(curl -s -o /dev/null -w "%{http_code}\n" "$PACKAGE_URL")
if [[ "$STATUS" = "200" ]]; then
echo "Have access to documentserver${{ matrix.edition }} amd64 arch >> check arm64 access"
2022-07-11 13:27:43 +03:00
else
echo "FAILED: Have no access to documentserver${{ matrix.edition }} amd64 arch"
exit 1
fi
2022-07-11 13:27:43 +03:00
PACKAGE_URL=${{ secrets.REPO_URL }}${{ matrix.edition }}_"$PACKAGE_VERSION"_arm64.deb
STATUS=$(curl -s -o /dev/null -w "%{http_code}\n" "$PACKAGE_URL")
if [[ "$STATUS" = "200" ]]; then
echo "Have access to documentserver${{ matrix.edition }} arm64 arch"
echo "All architecture are available >> build is starting."
sed -i "s|http://download.onlyoffice.com/install/documentserver/linux/\${COMPANY_NAME}-\${PRODUCT_NAME}\${PRODUCT_EDITION}|${{ secrets.REPO_URL }}${{ matrix.edition }}_$PACKAGE_VERSION|g" Dockerfile
PRODUCT_EDITION=${{ matrix.edition }} COMPANY_NAME=${{ env.COMPANY_NAME }} \
PRODUCT_NAME=${{ env.PRODUCT_NAME }} DOCKERFILE=Dockerfile \
PREFIX_NAME=4testing- TAG=$DOCKER_TAG \
docker buildx bake \
-f docker-bake.hcl ${{ matrix.images }} \
--push
echo "DONE: Build success >> exit with 0"
exit 0
else
echo "FAILED: Have no access to some required architecture documentserver${{ matrix.edition }} >> Exit with 0."
exit 1
fi
shell: bash