64 lines
2 KiB
YAML
64 lines
2 KiB
YAML
name: Build
|
|
|
|
on:
|
|
schedule:
|
|
- cron: "0 0 * * 1"
|
|
push:
|
|
tags:
|
|
- 'manual_build'
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Get upstream repository
|
|
run: |
|
|
git clone https://github.com/ONLYOFFICE/DocumentServer/ upstream
|
|
|
|
- name: Extract tags and labels for Docker
|
|
id: meta
|
|
run: |
|
|
export VERSION="$(cd upstream && git describe --tags --abbrev=0 | cut -d 'v' -f2-)"
|
|
echo "Version: ${VERSION}"
|
|
echo "tag=${VERSION}" >> $GITHUB_OUTPUT
|
|
shell: bash
|
|
|
|
- name: Check if the image was already built
|
|
id: check-build-status
|
|
run: |
|
|
echo ${{ steps.meta.outputs.tag }}
|
|
if curl --silent -f -lSL "https://hub.docker.com/v2/repositories/jiriks74/onlyoffice-documentserver/tags/$(echo ${{ steps.meta.outputs.tag }})" > /dev/null; then echo "Already exists" && exit 0; else echo "Desn't exist" && exit 0; fi
|
|
|
|
- name: Set tag in Dockerfile
|
|
run: |
|
|
sed -i "s/ARG PACKAGE_VERSION=/ARG PACKAGE_VERSION=$(echo ${{ steps.meta.outputs.tag }} | cut -d ':' -f2)/g" Dockerfile
|
|
|
|
- name: Install Docker
|
|
uses: awalsh128/cache-apt-pkgs-action@latest
|
|
with:
|
|
packages: docker.io
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v2
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v1
|
|
with:
|
|
platforms: linux/amd64,linux/arm64
|
|
|
|
- name: Login to DockerHub
|
|
uses: docker/login-action@v1
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
- name: Build and push image
|
|
uses: docker/build-push-action@v2
|
|
with:
|
|
push: true
|
|
tags: jiriks74/onlyoffice-documentserver:${{ steps.meta.outputs.tag }},jiriks74/onlyoffice-documentserver:latest
|
|
platforms: linux/amd64,linux/arm64
|
|
context: .
|
|
file: ./Dockerfile
|