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