fix: Docker meta action cannot get git tags
Some checks failed
Build / build (push) Failing after 39s

This commit is contained in:
Jiří Štefka 2024-01-27 03:05:57 +01:00
parent 19d79af2db
commit 57aa057198
Signed by: jiriks74
GPG key ID: 1D5E30D3DB2264DE

View file

@ -9,25 +9,15 @@ on:
jobs:
build:
runs-on: ubuntu-latest
outputs:
tags: ${{ steps.meta.outputs.tags }}
steps:
- name: Checkout
uses: actions/checkout@v4
# with:
# path: my-repo
# - name: Check is image already exists
# id: extract-version
# run: |
# git clone https://github.com/ONLYOFFICE/DocumentServer
# cd DocumentServer
# docker_tag=$(git describe --tags --abbrev=0 | cut -d 'v' -f2-)
# echo $docker_tag
# cd ..
# echo "docker_tag=${docker_tag}" >> GITEA_OUTPUT
# 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
# shell: bash
- name: Install Docker
run: |
apt-get update
@ -47,11 +37,14 @@ jobs:
- name: Extract tags and labels for Docker
id: meta
uses: docker/metadata-action@v5.5.0
working-directory: upstream
with:
images: jiriks74/onlyoffice-documentserver
context: git
run: |
export latest_tag=$(git describe --tags --abbrev=0 | cut -d 'v' -f2-)
export tags="jiriks74/onlyoffice-documentserver:${latest_tag},jiriks74/onlyoffice-documentserver:latest"
echo $tags
echo "tags=${tags}" >> "$GITEA_OUTPUT"
echo "tags=${tags}"
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
- name: Check if the image was already built
id: check-build-status
@ -60,12 +53,6 @@ jobs:
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
uses: docker/login-action@v1
with:
@ -76,8 +63,8 @@ jobs:
uses: docker/build-push-action@v2
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ needs.build.outputs.tags }}
# labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
context: .
file: ./Dockerfile