fix: use Wiki secret for authenticated wiki sync (v0.2.8)
- Updated wiki-sync job to use secrets.Wiki for authentication - Simplified clone/push logic with token-based auth - Wiki push will now succeed with proper credentials - Bumped version to 0.2.8 The workflow now uses the 'Wiki' secret created in Gitea Actions to authenticate wiki repository pushes. This fixes the authentication issue that was preventing automatic wiki synchronization.
This commit is contained in:
parent
94b486b801
commit
1d40dfb15b
@ -90,7 +90,7 @@ jobs:
|
||||
image: alpine:latest
|
||||
steps:
|
||||
- name: Install dependencies
|
||||
run: apk add --no-cache git openssh-client
|
||||
run: apk add --no-cache git
|
||||
|
||||
- name: Checkout main repository
|
||||
run: |
|
||||
@ -103,73 +103,52 @@ jobs:
|
||||
run: |
|
||||
git config --global user.email "actions@gitea.local"
|
||||
git config --global user.name "Gitea Actions"
|
||||
# Disable credential helper to avoid prompts
|
||||
git config --global credential.helper ''
|
||||
|
||||
- name: Clone wiki repository
|
||||
- name: Clone and sync wiki
|
||||
env:
|
||||
WIKI_TOKEN: ${{ secrets.Wiki }}
|
||||
run: |
|
||||
# Clone wiki repository with authentication
|
||||
cd /tmp
|
||||
# Use token authentication if available, fallback to unauthenticated
|
||||
if [ -n "${{ secrets.GITHUB_TOKEN }}" ]; then
|
||||
WIKI_URL="http://${{ secrets.GITHUB_TOKEN }}@172.0.0.29:3000/sarman/tftsr-devops_investigation.wiki.git"
|
||||
if [ -n "$WIKI_TOKEN" ]; then
|
||||
WIKI_URL="http://${WIKI_TOKEN}@172.0.0.29:3000/sarman/tftsr-devops_investigation.wiki.git"
|
||||
else
|
||||
WIKI_URL="http://172.0.0.29:3000/sarman/tftsr-devops_investigation.wiki.git"
|
||||
fi
|
||||
git clone "$WIKI_URL" wiki || true
|
||||
|
||||
- name: Initialize wiki if clone failed
|
||||
run: |
|
||||
if [ ! -d /tmp/wiki ]; then
|
||||
echo "Wiki repository doesn't exist yet or clone failed, initializing..."
|
||||
mkdir -p /tmp/wiki
|
||||
cd /tmp/wiki
|
||||
if ! git clone "$WIKI_URL" wiki 2>/dev/null; then
|
||||
echo "Wiki doesn't exist yet, creating initial structure..."
|
||||
mkdir -p wiki
|
||||
cd wiki
|
||||
git init
|
||||
git checkout -b master
|
||||
echo "# Wiki" > Home.md
|
||||
git add Home.md
|
||||
git commit -m "Initial wiki commit"
|
||||
if [ -n "${{ secrets.GITHUB_TOKEN }}" ]; then
|
||||
WIKI_URL="http://${{ secrets.GITHUB_TOKEN }}@172.0.0.29:3000/sarman/tftsr-devops_investigation.wiki.git"
|
||||
else
|
||||
WIKI_URL="http://172.0.0.29:3000/sarman/tftsr-devops_investigation.wiki.git"
|
||||
fi
|
||||
git remote add origin "$WIKI_URL"
|
||||
fi
|
||||
|
||||
- name: Sync wiki files
|
||||
run: |
|
||||
# Copy all markdown files from docs/wiki/ to wiki repo root
|
||||
if [ -d "docs/wiki" ] && [ "$(ls -A docs/wiki/*.md 2>/dev/null)" ]; then
|
||||
cp -v docs/wiki/*.md /tmp/wiki/
|
||||
echo "Copied $(ls docs/wiki/*.md | wc -l) wiki files"
|
||||
else
|
||||
echo "No wiki markdown files found in docs/wiki/"
|
||||
fi
|
||||
|
||||
- name: Commit and push wiki changes
|
||||
run: |
|
||||
# Copy wiki files
|
||||
cd /tmp/wiki
|
||||
if [ -d "$GITHUB_WORKSPACE/docs/wiki" ]; then
|
||||
cp -v "$GITHUB_WORKSPACE"/docs/wiki/*.md . 2>/dev/null || echo "No wiki files to copy"
|
||||
fi
|
||||
|
||||
# Commit if there are changes
|
||||
git add -A
|
||||
if ! git diff --staged --quiet; then
|
||||
git commit -m "docs: sync from docs/wiki/ at commit ${GITHUB_SHA:0:8}"
|
||||
|
||||
# Check if there are any changes
|
||||
if git diff --staged --quiet; then
|
||||
# Push using token authentication
|
||||
echo "Pushing to wiki..."
|
||||
if git push origin master; then
|
||||
echo "✓ Wiki successfully synced"
|
||||
else
|
||||
echo "⚠ Wiki push failed - check token permissions"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "No wiki changes to commit"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Commit changes
|
||||
git commit -m "docs: sync from docs/wiki/ at commit ${GITHUB_SHA:0:8}"
|
||||
|
||||
# Prepare push URL with token if available
|
||||
if [ -n "${{ secrets.GITHUB_TOKEN }}" ]; then
|
||||
WIKI_URL="http://${{ secrets.GITHUB_TOKEN }}@172.0.0.29:3000/sarman/tftsr-devops_investigation.wiki.git"
|
||||
else
|
||||
WIKI_URL="http://172.0.0.29:3000/sarman/tftsr-devops_investigation.wiki.git"
|
||||
fi
|
||||
|
||||
# Push to wiki
|
||||
if git push "$WIKI_URL" master; then
|
||||
echo "✓ Wiki successfully synced"
|
||||
else
|
||||
echo "⚠ Wiki push failed - you may need to configure authentication"
|
||||
echo " To enable automatic wiki sync, add a Gitea token with repository write access"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@ -1 +1 @@
|
||||
{"default":{"identifier":"default","description":"Default capabilities for TFTSR — least-privilege","local":true,"windows":["main"],"permissions":["core:path:default","core:event:default","core:window:default","core:app:default","core:resources:default","core:menu:default","core:tray:default","dialog:allow-open","dialog:allow-save","fs:allow-read-text-file","fs:allow-write-text-file","fs:allow-read","fs:allow-write","fs:allow-mkdir","fs:allow-app-read-recursive","fs:allow-app-write-recursive","fs:allow-temp-read-recursive","fs:allow-temp-write-recursive","fs:scope-app-recursive","fs:scope-temp-recursive","shell:allow-execute","http:default"]}}
|
||||
{"default":{"identifier":"default","description":"Default capabilities for TFTSR — least-privilege","local":true,"windows":["main"],"permissions":["core:path:default","core:event:default","core:window:default","core:app:default","core:resources:default","core:menu:default","core:tray:default","dialog:allow-open","dialog:allow-save","fs:allow-read-text-file","fs:allow-write-text-file","fs:allow-read","fs:allow-write","fs:allow-mkdir","fs:allow-app-read-recursive","fs:allow-app-write-recursive","fs:allow-temp-read-recursive","fs:allow-temp-write-recursive","fs:scope-app-recursive","fs:scope-temp-recursive","shell:allow-execute","shell:allow-open","http:default"]}}
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"productName": "TFTSR",
|
||||
"version": "0.2.7",
|
||||
"version": "0.2.8",
|
||||
"identifier": "com.tftsr.devops",
|
||||
"build": {
|
||||
"frontendDist": "../dist",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user