diff --git a/.github/workflows/basic-tests.yml b/.github/workflows/basic-tests.yml index 7bc7234..cd7de7d 100644 --- a/.github/workflows/basic-tests.yml +++ b/.github/workflows/basic-tests.yml @@ -5,8 +5,6 @@ name: Test Branch CI - Basic Tests on: push: branches: [ test ] - pull_request: - branches: [ test ] jobs: build-and-test: diff --git a/.github/workflows/deploy-docs-latest.yml b/.github/workflows/deploy-docs-latest.yml index 4740682..fbf347a 100644 --- a/.github/workflows/deploy-docs-latest.yml +++ b/.github/workflows/deploy-docs-latest.yml @@ -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/ diff --git a/.github/workflows/deploy-docs-stable.yml b/.github/workflows/deploy-docs-stable.yml index 5f4685a..0b41a78 100644 --- a/.github/workflows/deploy-docs-stable.yml +++ b/.github/workflows/deploy-docs-stable.yml @@ -5,7 +5,6 @@ name: Deploy Documentation - Stable on: push: branches: [ master ] - tags: [ 'v*' ] jobs: build-and-deploy: @@ -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 @@ -58,8 +44,8 @@ jobs: echo '' >> ../original_docs/docs/html/version.html echo '
' >> ../original_docs/docs/html/version.html echo 'Version: ${{ steps.version.outputs.docs-version }}
" >> ../original_docs/docs/html/version.html - echo 'Branch: master
' >> ../original_docs/docs/html/version.html + echo 'Version: stable
' >> ../original_docs/docs/html/version.html + echo 'Branch: master
' >> index.html echo "Build Date: $(date -u)
" >> ../original_docs/docs/html/version.html echo "Commit: ${{ github.sha }}
" >> ../original_docs/docs/html/version.html echo '' >> ../original_docs/docs/html/version.html @@ -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 '' > index.html @@ -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 \ No newline at end of file diff --git a/.github/workflows/deploy-docs-tags.yml b/.github/workflows/deploy-docs-tags.yml new file mode 100644 index 0000000..c56feac --- /dev/null +++ b/.github/workflows/deploy-docs-tags.yml @@ -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 '' > ../original_docs/docs/html/version.html + echo '' >> ../original_docs/docs/html/version.html + echo '' >> ../original_docs/docs/html/version.html + echo 'Version: ${{ steps.version.outputs.docs-version }}
" >> ../original_docs/docs/html/version.html + echo "Tag: ${{ github.ref_name }}
" >> ../original_docs/docs/html/version.html + echo "Build Date: $(date -u)
" >> ../original_docs/docs/html/version.html + echo "Commit: ${{ github.sha }}
" >> ../original_docs/docs/html/version.html + echo '' >> ../original_docs/docs/html/version.html + echo '' >> ../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 '' > index.html + echo '' >> index.html + echo '' >> index.html + echo ' ' >> index.html + echo '' >> index.html + echo '' >> index.html + echo 'Redirecting to stable documentation...
' >> index.html + echo 'Available versions:
' >> index.html + echo 'Recent tag versions:
' >> index.html + echo 'Select a version:
' >> versions/index.html + echo '