Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
makhoninvit authored and Vitaliy Makhonin committed Nov 1, 2024
1 parent b6c4e0f commit e9de63b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/agent-dev-tagging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ run-name: Add tag for agent-develop branch
on:
push:
branches:
- agent-develop
- main-dev

env:
REGISTRY: ghcr.io
Expand All @@ -24,10 +24,10 @@ jobs:
- run: |
git config --global user.email "${{ github.event.commits[0].author.email }}"
git config --global user.name "${{ github.event.commits[0].author.name }}"
git tag -d agent-dev
git push --delete origin agent-dev
git tag -d main-develop
git push --delete origin main-develop
git tag agent-dev ${{ env.commit_part }}
git push origin agent-dev
git push origin main-develop
build-container:
runs-on: ubuntu-latest
Expand All @@ -53,7 +53,7 @@ jobs:
context: .
push: true
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:agent-dev
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:main-dev
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
24 changes: 14 additions & 10 deletions .github/workflows/agent-tagging.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
name: Add tag for agent
run-name: Add tag for agent
name: Add tag for main
run-name: Add tag for main
on:
push:
branches:
- agent

- main
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
Expand All @@ -21,7 +20,12 @@ jobs:
run: git status
- name: "Get latest tag"
id: latest_tag
run: echo "latest_tag=$(git tag --merged agent --sort=-v:refname agent-v* | head -1)" >> $GITHUB_ENV
run: |
latest_tag=$(git tag --merged main --sort=-v:refname agent-main-v* | head -1)
if [ -z "${latest_tag}" ];then
latest_tag="agent-main-v0.0.0"
fi
echo "latest_tag=$latest_tag" >> $GITHUB_ENV
- run: |
echo "new_tag=$(echo "${{ env.latest_tag }}" | awk -F. -v OFS=. 'NF==1{print ++$NF}; NF>1{if(length($NF+1)>length($NF))$(NF-1)++; $NF=sprintf("%0*d", length($NF), ($NF+1)%(10^length($NF))); print}')" >> $GITHUB_ENV
- run: |
Expand All @@ -30,11 +34,11 @@ jobs:
- run: |
git config --global user.email "${{ github.event.commits[0].author.email }}"
git config --global user.name "${{ github.event.commits[0].author.name }}"
git tag -d agent-latest
git push --delete origin agent-latest
git tag agent-latest ${{ env.commit_part }}
git tag -d agent-main
git push --delete origin agent-main
git tag agent-main ${{ env.commit_part }}
git tag ${{ env.new_tag }} ${{ env.commit_part }}
git push origin agent-latest
git push origin agent-main
git push origin ${{ env.new_tag }}
build-container:
Expand All @@ -61,7 +65,7 @@ jobs:
context: .
push: true
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:agent-latest
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:agent-main
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

0 comments on commit e9de63b

Please sign in to comment.