deploy: git checkout by git ref, not branch name
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user