From abd8c8fc959833f45a195db49472be202863072a Mon Sep 17 00:00:00 2001 From: jiriks74 Date: Sat, 27 Jan 2024 03:28:43 +0100 Subject: [PATCH] fix: Outputs not working --- .gitea/workflows/build.yml | 32 +++++++++++--------------------- 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index b6a1b51..062e2ce 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -10,14 +10,10 @@ 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: Install Docker run: | apt-get update @@ -29,32 +25,27 @@ jobs: - 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 - run: git clone https://github.com/ONLYOFFICE/DocumentServer upstream && ls -la + run: | + git clone https://github.com/ONLYOFFICE/DocumentServer/ upstream - name: Extract tags and labels for Docker id: meta - # working-directory: upstream run: | - # export latest_tag=$(git describe --tags --abbrev=0 | cut -d 'v' -f2-) - # export tags="jiriks74/onlyoffice-documentserver:$(git describe --tags --abbrev=0 | cut -d 'v' -f2-),jiriks74/onlyoffice-documentserver:latest" - echo "tags=jiriks74/onlyoffice-documentserver:$(cd upstream && git describe --tags --abbrev=0 | cut -d 'v' -f2-),jiriks74/onlyoffice-documentserver:latest" >> "$GITEA_OUTPUT" - echo "tags=jiriks74/onlyoffice-documentserver:$(cd upstream && git describe --tags --abbrev=0 | cut -d 'v' -f2-),jiriks74/onlyoffice-documentserver:latest" - # echo $tags - # echo "tags=$(echo $tags)" >> "$GITEA_OUTPUT" - # echo "tags=$(echo $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 + echo "$(cd upstream && git describe --tags --abbrev=0 | cut -d 'v' -f2-)" + echo "tag=$(cd upstream && git describe --tags --abbrev=0 | cut -d 'v' -f2-)" >> $GITHUB_OUTPUT shell: bash - 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 + if curl --silent -f -lSL "https://hub.docker.com/v2/repositories/jiriks74/onlyoffice-documentserver/tags/$(echo ${{ steps.meta.outputs.tags }} | cut -d ':' -f2)" > /dev/null; then echo "Desn't exist" && exit 0; else echo "Already existst" && exit 1; 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: Login to DockerHub uses: docker/login-action@v1 @@ -66,8 +57,7 @@ jobs: uses: docker/build-push-action@v2 with: push: true - tags: ${{ needs.build.outputs.tags }} - # labels: ${{ steps.meta.outputs.labels }} + tags: jiriks74/onlyoffice-documentserver:${{ steps.meta.outputs.tag }},jiriks74/onlyoffice-documentserver:latest platforms: linux/amd64,linux/arm64 context: . file: ./Dockerfile