2023-10-17 13:46:52 +02:00
|
|
|
name: Build
|
|
|
|
|
|
|
|
on:
|
|
|
|
schedule:
|
|
|
|
- cron: "0 0 * * 1"
|
2023-11-21 19:26:40 +01:00
|
|
|
push:
|
|
|
|
tags:
|
|
|
|
- 'manual_build'
|
2023-10-17 13:46:52 +02:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
2023-11-21 20:34:41 +01:00
|
|
|
- name: Check is image already exists
|
2023-11-21 20:31:19 +01:00
|
|
|
id: extract-version
|
2023-10-17 13:46:52 +02:00
|
|
|
run: |
|
|
|
|
git clone https://github.com/ONLYOFFICE/DocumentServer
|
|
|
|
cd DocumentServer
|
2023-11-21 20:34:41 +01:00
|
|
|
docker_tag=$(git describe --tags --abbrev=0 | cut -d 'v' -f2-)
|
2023-11-21 19:26:40 +01:00
|
|
|
echo $docker_tag
|
2023-11-21 20:31:19 +01:00
|
|
|
echo "docker_tag=${docker_tag}" >> GITHUB_OUTPUT
|
2023-11-21 20:34:41 +01:00
|
|
|
if curl --silent -f -lSL "https://hub.docker.com/v2/repositories/jiriks74/onlyoffice-documentserver/tags/${docker_tag}" > /dev/null; then exit 1; fi
|
2023-11-21 19:46:00 +01:00
|
|
|
shell: bash
|
|
|
|
|
2023-11-21 20:34:41 +01:00
|
|
|
- name: Remove temporary files
|
2023-11-21 19:46:00 +01:00
|
|
|
if: steps.check-existing.conclusion == 'success'
|
2023-11-21 20:34:41 +01:00
|
|
|
id: remove-temp
|
|
|
|
run: |
|
|
|
|
echo ${{ steps.extract-version.outputs.docker_tag }}
|
|
|
|
rm -rf DocumentServer
|
2023-10-17 13:46:52 +02:00
|
|
|
shell: bash
|
|
|
|
|
|
|
|
- name: Install Docker
|
2023-11-21 19:46:00 +01:00
|
|
|
if: steps.check-existing.conclusion == 'success'
|
2023-10-17 13:46:52 +02:00
|
|
|
run: |
|
|
|
|
apt-get update
|
|
|
|
apt-get install docker.io -y
|
|
|
|
|
|
|
|
- name: Login to DockerHub
|
2023-11-21 19:46:00 +01:00
|
|
|
if: steps.check-existing.conclusion == 'success'
|
2023-10-17 13:46:52 +02:00
|
|
|
uses: docker/login-action@v1
|
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
|
|
|
|
- name: Set up QEMU
|
2023-11-21 19:46:00 +01:00
|
|
|
if: steps.check-existing.conclusion == 'success'
|
2023-10-17 13:46:52 +02:00
|
|
|
uses: docker/setup-qemu-action@v2
|
|
|
|
- name: Set up Docker Buildx
|
2023-11-21 19:46:00 +01:00
|
|
|
if: steps.check-existing.conclusion == 'success'
|
2023-10-17 13:46:52 +02:00
|
|
|
uses: docker/setup-buildx-action@v1
|
|
|
|
with:
|
|
|
|
# driver-opts: network=host
|
|
|
|
platforms: linux/amd64,linux/arm64
|
|
|
|
|
|
|
|
- name: Build and push image
|
2023-11-21 19:46:00 +01:00
|
|
|
if: steps.check-existing.conclusion == 'success'
|
2023-10-17 13:46:52 +02:00
|
|
|
uses: docker/build-push-action@v2
|
|
|
|
with:
|
|
|
|
push: true
|
|
|
|
tags: jiriks74/onlyoffice-documentserver:${{ steps.extract-version.outputs.docker_tag }},jiriks74/onlyoffice-documentserver:latest
|
|
|
|
platforms: linux/amd64,linux/arm64
|
|
|
|
context: .
|
|
|
|
file: ./Dockerfile
|
2023-11-21 19:26:40 +01:00
|
|
|
|
|
|
|
- name: Image already built
|
|
|
|
id: image-built
|
2023-11-21 19:46:00 +01:00
|
|
|
if: steps.check-existing.conclusion == 'failure'
|
2023-11-21 19:26:40 +01:00
|
|
|
run: |
|
|
|
|
echo "Image was already built and uploaded"
|
|
|
|
exit 0
|
|
|
|
shell: bash
|