From 166e2234291fe4cc29f56ed2354976f392bda1e7 Mon Sep 17 00:00:00 2001 From: Nathan Woodburn Date: Thu, 24 Aug 2023 17:31:40 +1000 Subject: [PATCH] actions: Fixed tags --- .gitea/workflows/build.yml | 47 +++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 09779e0..50b76f4 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -23,20 +23,21 @@ jobs: echo "${{ secrets.DOCKERGIT_TOKEN }}" | docker login git.woodburn.au -u nathanwoodburn --password-stdin tag_num=$(git rev-parse --short HEAD) echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" - if [ "${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" = "master" ]; then - docker build -t hnshosting-master:$tag_num . - docker tag hnshosting-master:$tag_num git.woodburn.au/nathanwoodburn/hnshosting-master:$tag_num - docker push git.woodburn.au/nathanwoodburn/hnshosting-master:$tag_num - docker tag hnshosting-master:$tag_num git.woodburn.au/nathanwoodburn/hnshosting-master:latest - docker push git.woodburn.au/nathanwoodburn/hnshosting-master:latest + tag=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}} + if [ tag = "main" ]; then + $tag = "latest" else - docker build -t hnshosting-master-dev:$tag_num . - docker tag hnshosting-master-dev:$tag_num git.woodburn.au/nathanwoodburn/hnshosting-master-dev:$tag_num - docker push git.woodburn.au/nathanwoodburn/hnshosting-master-dev:$tag_num - docker tag hnshosting-master-dev:$tag_num git.woodburn.au/nathanwoodburn/hnshosting-master-dev:latest - docker push git.woodburn.au/nathanwoodburn/hnshosting-master-dev:latest + $tag_num = $tag +"-"+ $tag_num fi + docker build -t hnshosting-master:$tag_num . + docker tag hnshosting-master:$tag_num git.woodburn.au/nathanwoodburn/hnshosting-master:$tag_num + docker push git.woodburn.au/nathanwoodburn/hnshosting-master:$tag_num + docker tag hnshosting-master:$tag_num git.woodburn.au/nathanwoodburn/hnshosting-master:$tag + docker push git.woodburn.au/nathanwoodburn/hnshosting-master:$tag + + + Build Bot: @@ -59,16 +60,16 @@ jobs: echo "${{ secrets.DOCKERGIT_TOKEN }}" | docker login git.woodburn.au -u nathanwoodburn --password-stdin tag_num=$(git rev-parse --short HEAD) echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" - if [ "${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" = "master" ]; then - docker build -t hnshosting-bot:$tag_num . - docker tag hnshosting-bot:$tag_num git.woodburn.au/nathanwoodburn/hnshosting-bot:$tag_num - docker push git.woodburn.au/nathanwoodburn/hnshosting-bot:$tag_num - docker tag hnshosting-bot:$tag_num git.woodburn.au/nathanwoodburn/hnshosting-bot:latest - docker push git.woodburn.au/nathanwoodburn/hnshosting-bot:latest + tag=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}} + if [ tag = "main" ]; then + $tag = "latest" else - docker build -t hnshosting-bot-dev:$tag_num . - docker tag hnshosting-bot-dev:$tag_num git.woodburn.au/nathanwoodburn/hnshosting-bot-dev:$tag_num - docker push git.woodburn.au/nathanwoodburn/hnshosting-bot-dev:$tag_num - docker tag hnshosting-bot-dev:$tag_num git.woodburn.au/nathanwoodburn/hnshosting-bot-dev:latest - docker push git.woodburn.au/nathanwoodburn/hnshosting-bot-dev:latest - fi \ No newline at end of file + $tag_num = $tag +"-"+ $tag_num + fi + + docker build -t hnshosting-bot:$tag_num . + docker tag hnshosting-bot:$tag_num git.woodburn.au/nathanwoodburn/hnshosting-bot:$tag_num + docker push git.woodburn.au/nathanwoodburn/hnshosting-bot:$tag_num + docker tag hnshosting-bot:$tag_num git.woodburn.au/nathanwoodburn/hnshosting-bot:$tag + docker push git.woodburn.au/nathanwoodburn/hnshosting-bot:$tag + \ No newline at end of file