Hotfix/Fix push version update (#8)
Some checks failed
Build and Publish Docker Image / Build and Validate (push) Successful in 8s
Build and Publish Docker Image / Publish to Registry (push) Failing after 6s

Reviewed-on: #8
Co-authored-by: Juan Sebastian Montoya <juansmm@outlook.com>
Co-committed-by: Juan Sebastian Montoya <juansmm@outlook.com>
This commit is contained in:
Juan Sebastián Montoya 2025-11-26 11:58:12 -05:00 committed by Juan Sebastián Montoya
parent 22c16e533e
commit 171be2ef17

View file

@ -50,6 +50,7 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for tags
token: ${{ secrets.FORGEBOT_ACCESS_TOKEN }}
- name: Login to Registry
run: |
@ -165,8 +166,22 @@ jobs:
echo "📝 Updating version files to: $VERSION"
# Configure git
git config user.name "forgejo-actions"
git config user.email "forgejo-actions@forgejo.io"
git config user.name "forgebot"
git config user.email "forgebot@forgejo.io"
# Configure remote URL with token for authentication
# Extract repository URL and add token
REPO_URL=$(git remote get-url origin)
# Handle both https and git@ formats
if [[ "$REPO_URL" == https://* ]]; then
# Extract domain and path from https URL
REPO_PATH=$(echo "$REPO_URL" | sed 's|https://||' | sed 's|git@||' | sed 's|:|/|')
git remote set-url origin "https://${{ secrets.FORGEBOT_ACCESS_TOKEN }}@${REPO_PATH}"
else
# For git@ format, convert to https with token
REPO_PATH=$(echo "$REPO_URL" | sed 's|git@||' | sed 's|:|/|')
git remote set-url origin "https://${{ secrets.FORGEBOT_ACCESS_TOKEN }}@${REPO_PATH}"
fi
# Fetch latest changes to avoid conflicts
git fetch origin main || echo "Fetch completed or already up to date"
@ -198,9 +213,9 @@ jobs:
exit 0
}
# Push to main branch
# Push to main branch using the token
git push origin main || {
echo "⚠️ Push failed (may need manual intervention or branch protection)"
echo "⚠️ Push failed (check token permissions)"
exit 0
}