fix: Use docker meta action to get tags
This commit is contained in:
parent
c981844975
commit
77f4adf134
@ -13,50 +13,71 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Check is image already exists
|
# - name: Check is image already exists
|
||||||
id: extract-version
|
# id: extract-version
|
||||||
run: |
|
# run: |
|
||||||
git clone https://github.com/ONLYOFFICE/DocumentServer
|
# git clone https://github.com/ONLYOFFICE/DocumentServer
|
||||||
cd DocumentServer
|
# cd DocumentServer
|
||||||
docker_tag=$(git describe --tags --abbrev=0 | cut -d 'v' -f2-)
|
# docker_tag=$(git describe --tags --abbrev=0 | cut -d 'v' -f2-)
|
||||||
echo $docker_tag
|
# echo $docker_tag
|
||||||
cd ..
|
# cd ..
|
||||||
echo "docker_tag=${docker_tag}" >> GITEA_OUTPUT
|
# echo "docker_tag=${docker_tag}" >> GITEA_OUTPUT
|
||||||
echo "docker_tag=${docker_tag}"
|
# echo "docker_tag=${docker_tag}"
|
||||||
if curl --silent -f -lSL "https://hub.docker.com/v2/repositories/jiriks74/onlyoffice-documentserver/tags/${docker_tag}" > /dev/null; then exit 1; else exit 0; fi
|
# if curl --silent -f -lSL "https://hub.docker.com/v2/repositories/jiriks74/onlyoffice-documentserver/tags/${docker_tag}" > /dev/null; then exit 1; else exit 0; fi
|
||||||
shell: bash
|
# shell: bash
|
||||||
|
|
||||||
- name: Remove temporary files
|
|
||||||
id: remove-temp
|
|
||||||
run: |
|
|
||||||
echo ${{ steps.extract-version.outputs.docker_tag }}
|
|
||||||
rm -rf DocumentServer
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: Install Docker
|
- name: Install Docker
|
||||||
run: |
|
run: |
|
||||||
apt-get update
|
apt-get update
|
||||||
apt-get install docker.io -y
|
apt-get install docker.io -y
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v2
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v1
|
||||||
|
with:
|
||||||
|
# driver-opts: network=host
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
|
|
||||||
|
- name: Get upstream repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
repository: https://github.com/ONLYOFFICE/DocumentServer/
|
||||||
|
ref: master
|
||||||
|
path: upstream
|
||||||
|
|
||||||
|
- name: Extract tags and labels for Docker
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v5.5.0
|
||||||
|
with:
|
||||||
|
images: jiriks74/onlyoffice-documentserver
|
||||||
|
context: upstream
|
||||||
|
|
||||||
|
- name: Check if the image was already built
|
||||||
|
id: check-build-status
|
||||||
|
run: |
|
||||||
|
echo ${{ steps.meta.outputs.tags }}
|
||||||
|
docker_tag=$(echo ${{ steps.meta.outputs.tags }} | cut -d ':' -f2)
|
||||||
|
if curl --silent -f -lSL "https://hub.docker.com/v2/repositories/jiriks74/onlyoffice-documentserver/tags/${docker_tag}" > /dev/null; then exit 1; else exit 0; fi
|
||||||
|
|
||||||
|
# - name: Remove temporary files
|
||||||
|
# id: remove-temp
|
||||||
|
# run: |
|
||||||
|
# rm -rf upstream
|
||||||
|
# shell: bash
|
||||||
|
|
||||||
- name: Login to DockerHub
|
- name: Login to DockerHub
|
||||||
uses: docker/login-action@v1
|
uses: docker/login-action@v1
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v2
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v1
|
|
||||||
with:
|
|
||||||
# driver-opts: network=host
|
|
||||||
platforms: linux/amd64,linux/arm64
|
|
||||||
|
|
||||||
- name: Build and push image
|
- name: Build and push image
|
||||||
uses: docker/build-push-action@v2
|
uses: docker/build-push-action@v2
|
||||||
with:
|
with:
|
||||||
push: true
|
push: true
|
||||||
tags: jiriks74/onlyoffice-documentserver:${{ steps.extract-version.outputs.docker_tag }},jiriks74/onlyoffice-documentserver:latest
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
context: .
|
context: .
|
||||||
file: ./Dockerfile
|
file: ./Dockerfile
|
||||||
|
Loading…
x
Reference in New Issue
Block a user