Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/basic-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ name: Test Branch CI - Basic Tests
on:
push:
branches: [ test ]
pull_request:
branches: [ test ]

jobs:
build-and-test:
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/deploy-docs-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,8 @@ jobs:
git clone -b master https://${{ secrets.GH_PAT }}@github.com/FrozenLemonTee/original_docs.git deploy-repo
cd deploy-repo

# Clean up old files (keep the .git directory)
find . -maxdepth 1 ! -name '.git' ! -name '.' ! -name 'CNAME' -exec rm -rf {} + 2>/dev/null || true

# Copy the new document to directory latest
# Only update latest directory
rm -rf latest
mkdir -p latest
cp -r ../../original_docs/docs/html/* latest/

Expand Down
38 changes: 7 additions & 31 deletions .github/workflows/deploy-docs-stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ name: Deploy Documentation - Stable
on:
push:
branches: [ master ]
tags: [ 'v*' ]

jobs:
build-and-deploy:
Expand All @@ -17,19 +16,6 @@ jobs:
with:
fetch-depth: 0

- name: Determine documentation version
id: version
run: |
if [[ $GITHUB_REF == refs/tags/* ]]; then
TAG=${GITHUB_REF#refs/tags/}
echo "docs-version=$TAG" >> $GITHUB_OUTPUT
echo "is-tag=true" >> $GITHUB_OUTPUT
else
echo "docs-version=stable" >> $GITHUB_OUTPUT
echo "is-tag=false" >> $GITHUB_OUTPUT
fi
echo "Version: ${{ steps.version.outputs.docs-version }}"

- name: Install dependencies
run: |
sudo apt-get update
Expand Down Expand Up @@ -58,8 +44,8 @@ jobs:
echo '</head>' >> ../original_docs/docs/html/version.html
echo '<body>' >> ../original_docs/docs/html/version.html
echo ' <h1>Documentation Version</h1>' >> ../original_docs/docs/html/version.html
echo " <p>Version: ${{ steps.version.outputs.docs-version }}</p>" >> ../original_docs/docs/html/version.html
echo ' <p>Branch: master</p>' >> ../original_docs/docs/html/version.html
echo ' <p>Version: stable</p>' >> ../original_docs/docs/html/version.html
echo ' <p>Branch: master</p>' >> index.html
echo " <p>Build Date: $(date -u)</p>" >> ../original_docs/docs/html/version.html
echo " <p>Commit: ${{ github.sha }}</p>" >> ../original_docs/docs/html/version.html
echo '</body>' >> ../original_docs/docs/html/version.html
Expand All @@ -78,20 +64,10 @@ jobs:

cd deploy-repo

# Clean up old files (keep the .git directory)
find . -maxdepth 1 ! -name '.git' ! -name '.' ! -name 'CNAME' -exec rm -rf {} + 2>/dev/null || true

if [[ "${{ steps.version.outputs.is-tag }}" == "true" ]]; then
# Tag Version: Create Version Directory
mkdir -p versions/${{ steps.version.outputs.docs-version }}
cp -r ../../original_docs/docs/html/* versions/${{ steps.version.outputs.docs-version }}/
echo "Deployed tag version: ${{ steps.version.outputs.docs-version }}"
else
# Branch master: update stable version
mkdir -p stable
cp -r ../../original_docs/docs/html/* stable/
echo "Deployed stable version from master"
fi
# Only update stable directory
rm -rf stable
mkdir -p stable
cp -r ../../original_docs/docs/html/* stable/

# Create index.html redirection
echo '<!DOCTYPE html>' > index.html
Expand All @@ -117,5 +93,5 @@ jobs:
else
git commit -m "Deploy ${{ steps.version.outputs.docs-version }} documentation from ${{ github.sha }}"
git push origin master
echo "Documentation deployed successfully"
echo "✅ Stable documentation deployed successfully"
fi
139 changes: 139 additions & 0 deletions .github/workflows/deploy-docs-tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
# .github/workflows/deploy-docs-tags.yml

name: Deploy Documentation - Tag Versions

on:
push:
tags:
- 'v*.*.*'

jobs:
build-and-deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Extract version from tag
id: version
run: |
VERSION=${GITHUB_REF#refs/tags/v}
echo "docs-version=$VERSION" >> $GITHUB_OUTPUT
echo "Detected version: $VERSION"

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y doxygen graphviz plantuml

- name: Build documentation
run: |
# Create the necessary directory structure
mkdir -p ../original_docs

# Run doxygen
doxygen Doxyfile

# Check whether the document was generated successfully
if [ ! -d "../original_docs/docs/html" ]; then
echo "Error: Documentation was not generated in expected location"
ls -la ../original_docs/docs/ || echo "Docs directory not found"
exit 1
fi

# Create version information file
echo '<!DOCTYPE html>' > ../original_docs/docs/html/version.html
echo '<html>' >> ../original_docs/docs/html/version.html
echo '<head>' >> ../original_docs/docs/html/version.html
echo ' <title>Version Info</title>' >> ../original_docs/docs/html/version.html
echo '</head>' >> ../original_docs/docs/html/version.html
echo '<body>' >> ../original_docs/docs/html/version.html
echo ' <h1>Documentation Version</h1>' >> ../original_docs/docs/html/version.html
echo " <p>Version: ${{ steps.version.outputs.docs-version }}</p>" >> ../original_docs/docs/html/version.html
echo " <p>Tag: ${{ github.ref_name }}</p>" >> ../original_docs/docs/html/version.html
echo " <p>Build Date: $(date -u)</p>" >> ../original_docs/docs/html/version.html
echo " <p>Commit: ${{ github.sha }}</p>" >> ../original_docs/docs/html/version.html
echo '</body>' >> ../original_docs/docs/html/version.html
echo '</html>' >> ../original_docs/docs/html/version.html

- name: Deploy to original_docs repository
env:
GH_PAT: ${{ secrets.GH_PAT }}
run: |
# Configure git
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"

# Clone document repository
git clone -b master https://${{ secrets.GH_PAT }}@github.com/FrozenLemonTee/original_docs.git deploy-repo
cd deploy-repo

# Create versions directory if it doesn't exist
mkdir -p versions

# Update specific version directory
VERSION_DIR="versions/${{ steps.version.outputs.docs-version }}"
rm -rf "$VERSION_DIR"
mkdir -p "$VERSION_DIR"
cp -r ../../original_docs/docs/html/* "$VERSION_DIR"/

# Update main index.html to include this version
echo '<!DOCTYPE html>' > index.html
echo '<html>' >> index.html
echo '<head>' >> index.html
echo ' <meta http-equiv="refresh" content="0; url=stable/index.html">' >> index.html
echo '</head>' >> index.html
echo '<body>' >> index.html
echo ' <p>Redirecting to <a href="stable/index.html">stable documentation</a>...</p>' >> index.html
echo ' <p>Available versions:</p>' >> index.html
echo ' <ul>' >> index.html
echo ' <li><a href="stable/index.html">Stable (master branch)</a></li>' >> index.html
echo ' <li><a href="latest/index.html">Latest (test branch)</a></li>' >> index.html
echo ' <li><a href="versions/">Tag versions</a></li>' >> index.html
echo ' </ul>' >> index.html
echo ' <p>Recent tag versions:</p>' >> index.html
echo ' <ul>' >> index.html

# List recent tag versions (last 5)
for dir in $(ls -1 versions/ | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | sort -V -r | head -5); do
echo " <li><a href=\"versions/$dir/index.html\">Version $dir</a></li>" >> index.html
done

echo ' </ul>' >> index.html
echo '</body>' >> index.html
echo '</html>' >> index.html

# Create versions/index.html to list all available versions
echo '<!DOCTYPE html>' > versions/index.html
echo '<html>' >> versions/index.html
echo '<head>' >> versions/index.html
echo ' <title>Versioned Documentation</title>' >> versions/index.html
echo '</head>' >> versions/index.html
echo '<body>' >> versions/index.html
echo ' <h1>Versioned Documentation</h1>' >> versions/index.html
echo ' <p>Select a version:</p>' >> versions/index.html
echo ' <ul>' >> versions/index.html

# List all versions in reverse order (newest first)
for dir in $(ls -1 versions/ | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | sort -V -r); do
echo " <li><a href=\"$dir/index.html\">Version $dir</a></li>" >> versions/index.html
done

echo ' </ul>' >> versions/index.html
echo ' <p><a href="../stable/index.html">Stable (master branch)</a></p>' >> versions/index.html
echo ' <p><a href="../latest/index.html">Latest (test branch)</a></p>' >> versions/index.html
echo '</body>' >> versions/index.html
echo '</html>' >> versions/index.html

# Submit and push
git add .
if git diff-index --quiet HEAD --; then
echo "No changes to deploy"
else
git commit -m "Deploy ${{ steps.version.outputs.docs-version }} documentation from tag ${{ github.ref_name }}"
git push origin master
echo "✅ Tag documentation version ${{ steps.version.outputs.docs-version }} deployed successfully"
fi
2 changes: 0 additions & 2 deletions .github/workflows/full-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
name: Master Branch CI - Full Tests

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set(ORIGINAL_VERSION 0.1.5)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED True)
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Build type (default Debug)" FORCE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type (default Release)" FORCE)
endif()

include(CMakePackageConfigHelpers)
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Original是一个C++基础工具库,也是本人的第一个正式项目,用

### 📋 历史版本 (Historical Versions)
- **版本**: 按发布标签
- [查看所有历史版本](../versions/)
- [查看所有历史版本](../versions/index.html)

---

Expand Down