deploy: git checkout by git ref, not branch name

This commit is contained in:
azykov@mail.ru
2026-07-01 11:01:21 +03:00
parent 4a936b03d6
commit 02eaf3606b
+11 -3
View File
@@ -20,12 +20,20 @@ jobs:
working-directory: /
run: |
mkdir -p /workspace
if [ -d /workspace/.git ]; then
cd /workspace && git fetch origin && git reset --hard origin/${{ gitea.ref_name }}
cd /workspace
if [ -d .git ]; then
git remote set-url origin ${{ gitea.server_url }}/${{ gitea.repository }}.git
else
git clone ${{ gitea.server_url }}/${{ gitea.repository }}.git /workspace
git init
git remote add origin ${{ gitea.server_url }}/${{ gitea.repository }}.git
fi
git fetch --prune origin ${{ gitea.ref_name }}
git checkout -f FETCH_HEAD
git reset --hard FETCH_HEAD
git clean -fdx
- name: Set lowercase image prefix
run: echo "IMAGE_PREFIX=$(echo '${{ gitea.repository }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV