diff --git a/.github/workflows/build-4testing.yml b/.github/workflows/build-4testing.yml new file mode 100644 index 0000000..59f3dee --- /dev/null +++ b/.github/workflows/build-4testing.yml @@ -0,0 +1,62 @@ +### This workflow setup instance then build and push images ### +name: Multi-arch build 4testing + +on: + push: + tags: + - "v*" + - "!v*-stable" + +jobs: + build: + name: Build + runs-on: ubuntu-latest + strategy: + matrix: + edition: ["", "-ee", "-de", "-ie"] + images: ["documentserver"] + 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/} + + - name: Build multi-arch documentserver image + run: | + PACKAGE_URL=http://download.onlyoffice.com/install/documentserver/linux/onlyoffice-documentserver${{ matrix.edition }}_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" + PACKAGE_URL=http://download.onlyoffice.com/install/documentserver/linux/onlyoffice-documentserver${{ matrix.edition }}_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." + DOCKER_TAG=$(echo ${{ steps.tag_name.outputs.SOURCE_TAG }} | sed 's/^.//' ) + PRODUCT_EDITION=${{ matrix.edition }} PRODUCT_NAME=documentserver DOCKERFILE=Dockerfile PREFIX_NAME=4testing- TAG=$DOCKER_TAG \ + docker buildx bake \ + -f docker-bake.hcl ${{ matrix.images }} \ + --push + echo "Build success >> exit with 0" + exit 0 + else + echo "Have no access to some architecture documentserver${{ matrix.edition }} >> Build did't started >> Exit with 0." + exit 0 + fi + fi + shell: bash diff --git a/.github/workflows/build-stable.yml b/.github/workflows/build-stable.yml new file mode 100644 index 0000000..6ddb3e4 --- /dev/null +++ b/.github/workflows/build-stable.yml @@ -0,0 +1,57 @@ +### 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: Build + runs-on: ubuntu-latest + strategy: + matrix: + edition: ["", "-ee", "-de", "-ie"] + images: ["documentserver-stable"] + 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/} + + - name: Build Community-Edition + run: | + DOCKER_TAG=$(echo ${{ steps.tag_name.outputs.SOURCE_TAG }} | sed 's/^.//; s/-stable//') + IMAGE_STATUS=$(docker manifest inspect ${{ env.COMPANY_NAME }}/4testing-${{ env.PRODUCT_NAME }}${{ matrix.edition }}:$DOCKER_TAG > /dev/null ; echo $?) + if [[ "$IMAGE_STATUS" = "0" ]]; then + echo "Image present on docker.hub >> start build stable version" + echo "FROM ${{ env.COMPANY_NAME }}/4testing-${{ env.PRODUCT_NAME }}${{ matrix.edition }}:$DOCKER_TAG as ${{ env.PRODUCT_NAME }}-stable" >> Dockerfile.stable + PRODUCT_EDITION=${{ matrix.edition }} PRODUCT_NAME=documentserver DOCKERFILE=Dockerfile.stable TAG=$DOCKER_TAG \ + docker buildx bake \ + -f docker-bake.hcl ${{ matrix.images }} \ + --push ; + else + echo "Image with tag $DOCKER_TAG do not presented on docker.hub >> build will not started >> exit with 0" + exit 0 + fi + shell: bash