fix: fix docs #7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Workflow derived from https://github.com/r-lib/actions/tree/v2/examples | |
| # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help | |
| on: | |
| push: | |
| branches: [main, master] | |
| tags: ['*'] | |
| name: pkgdown | |
| jobs: | |
| pkgdown: | |
| runs-on: ubuntu-latest | |
| # Only restrict concurrency for non-PR jobs | |
| concurrency: | |
| group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }} | |
| env: | |
| GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: r-lib/actions/setup-pandoc@v2 | |
| - uses: r-lib/actions/setup-r@v2 | |
| with: | |
| use-public-rspm: true | |
| - uses: r-lib/actions/setup-r-dependencies@v2 | |
| with: | |
| extra-packages: any::pkgdown, local::. | |
| needs: website | |
| - name: Build site | |
| run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) | |
| shell: Rscript {0} | |
| - name: Checkout blog repository | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: DiogoRibeiro7/DiogoRibeiro7.github.io | |
| token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
| path: blog-repo | |
| - name: Copy package docs to blog | |
| run: | | |
| # Create the packages directory in blog if it doesn't exist | |
| mkdir -p blog-repo/packages/myrpackage | |
| # Copy the built documentation | |
| cp -r docs/* blog-repo/packages/myrpackage/ | |
| # Update navigation and create index page | |
| cd blog-repo | |
| - name: Create package index page | |
| run: | | |
| cat > blog-repo/packages/index.md << 'EOF' | |
| --- | |
| layout: single | |
| title: "R Packages" | |
| permalink: /packages/ | |
| author_profile: true | |
| header: | |
| image: /assets/images/data_science_1.jpg | |
| overlay_image: /assets/images/data_science_1.jpg | |
| teaser: /assets/images/data_science_1.jpg | |
| show_overlay_excerpt: false | |
| twitter_image: /assets/images/data_science_1.jpg | |
| og_image: /assets/images/data_science_1.jpg | |
| seo_type: article | |
| --- | |
| # R Packages | |
| This section contains documentation for R packages I've developed. | |
| ## Available Packages | |
| ### [myrpackage](/packages/myrpackage/) | |
| A multilingual greeting and farewell package that demonstrates proper R package structure, documentation, and testing practices. It provides functions for greeting and saying farewell in multiple languages including English, Spanish, French, Portuguese, German, and Italian. | |
| **Features:** | |
| - Multilingual greetings and farewells | |
| - Comprehensive documentation and examples | |
| - Full test coverage | |
| - Proper R package structure | |
| - CI/CD pipeline with GitHub Actions | |
| [View Documentation →](/packages/myrpackage/) | |
| EOF | |
| - name: Update main navigation | |
| run: | | |
| # Create navigation entry for packages if it doesn't exist | |
| if ! grep -q "packages" blog-repo/_data/navigation.yml; then | |
| cat >> blog-repo/_data/navigation.yml << 'EOF' | |
| - title: "Packages" | |
| url: /packages/ | |
| EOF | |
| fi | |
| - name: Commit and push changes | |
| run: | | |
| cd blog-repo | |
| git config --local user.email "[email protected]" | |
| git config --local user.name "GitHub Action" | |
| git add . | |
| if git diff --staged --quiet; then | |
| echo "No changes to commit" | |
| else | |
| git commit -m "Update myrpackage documentation" | |
| git push | |
| fi |