fix(cicd): move tag extraction to it's own job
Some checks failed
Build / build (push) Failing after 45s
Some checks failed
Build / build (push) Failing after 45s
This commit is contained in:
parent
c091b8908a
commit
82ee7b2a4c
1 changed files with 20 additions and 10 deletions
|
@ -13,43 +13,53 @@ jobs:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Extract Version Tag
|
- name: Check is image already exists
|
||||||
id: extract-version
|
id: check-existing
|
||||||
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
|
||||||
if curl --silent -f -lSL "https://hub.docker.com/v2/repositories/jiriks74/onlyoffice-documentserver/tags/${docker_tag}" > /dev/null; then exit 1; fi
|
if curl --silent -f -lSL "https://hub.docker.com/v2/repositories/jiriks74/onlyoffice-documentserver/tags/${docker_tag}" > /dev/null; then exit 1; fi
|
||||||
cd .. && rm -rf DocumentServer
|
shell: bash
|
||||||
echo "docker_tag=$(git describe --tags --abbrev=0 | cut -d 'v' -f2-)" >> GITHUB_OUTPUT
|
|
||||||
|
- name: Extract Version Tag
|
||||||
|
if: steps.check-existing.conclusion == 'success'
|
||||||
|
id: extract-version
|
||||||
|
run: echo "docker_tag=$(git describe --tags --abbrev=0 | cut -d 'v' -f2-)" >> GITHUB_OUTPUT
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Remove temporary files
|
||||||
|
if: steps.check-existing.conclusion == 'success'
|
||||||
|
id: remove-temp
|
||||||
|
run: rm -rf DocumentServer
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Install Docker
|
- name: Install Docker
|
||||||
if: steps.extract-version.conclusion == 'success'
|
if: steps.check-existing.conclusion == 'success'
|
||||||
run: |
|
run: |
|
||||||
apt-get update
|
apt-get update
|
||||||
apt-get install docker.io -y
|
apt-get install docker.io -y
|
||||||
|
|
||||||
- name: Login to DockerHub
|
- name: Login to DockerHub
|
||||||
if: steps.extract-version.conclusion == 'success'
|
if: steps.check-existing.conclusion == 'success'
|
||||||
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
|
- name: Set up QEMU
|
||||||
if: steps.extract-version.conclusion == 'success'
|
if: steps.check-existing.conclusion == 'success'
|
||||||
uses: docker/setup-qemu-action@v2
|
uses: docker/setup-qemu-action@v2
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
if: steps.extract-version.conclusion == 'success'
|
if: steps.check-existing.conclusion == 'success'
|
||||||
uses: docker/setup-buildx-action@v1
|
uses: docker/setup-buildx-action@v1
|
||||||
with:
|
with:
|
||||||
# driver-opts: network=host
|
# driver-opts: network=host
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
|
|
||||||
- name: Build and push image
|
- name: Build and push image
|
||||||
if: steps.extract-version.conclusion == 'success'
|
if: steps.check-existing.conclusion == 'success'
|
||||||
uses: docker/build-push-action@v2
|
uses: docker/build-push-action@v2
|
||||||
with:
|
with:
|
||||||
push: true
|
push: true
|
||||||
|
@ -60,7 +70,7 @@ jobs:
|
||||||
|
|
||||||
- name: Image already built
|
- name: Image already built
|
||||||
id: image-built
|
id: image-built
|
||||||
if: steps.extract-version.conclusion == 'failure'
|
if: steps.check-existing.conclusion == 'failure'
|
||||||
run: |
|
run: |
|
||||||
echo "Image was already built and uploaded"
|
echo "Image was already built and uploaded"
|
||||||
exit 0
|
exit 0
|
||||||
|
|
Loading…
Reference in a new issue