TiagoMSSantos/MobileRT

View on GitHub
.github/workflows/jekyll.yml

Summary

Maintainability
Test Coverage
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

# Sample workflow for building and deploying a Jekyll site to GitHub Pages
name: Deploy Jekyll site to Pages

on:
  # Runs on pushes targeting any branch
  push:
    paths-ignore:
    - '*'
    - '**/**'
    - '!.github/workflows/jekyll.yml'
    - '!**/docs/**'
    - '!**/Gemfile*'

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
  contents: read
  pages: write
  id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
  group: "pages"
  cancel-in-progress: false

# Default environment variables.
env:
  GITHUB_STEP_TIMEOUT_SMALL: 4

jobs:
  # Build job
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        timeout-minutes: ${{ fromJSON(env.GITHUB_STEP_TIMEOUT_SMALL) }}
        if: success()
        uses: actions/checkout@v4

      - name: Lint documentation files
        timeout-minutes: ${{ fromJSON(env.GITHUB_STEP_TIMEOUT_SMALL) }}
        if: success()
        uses: docker://avtodev/markdown-lint:v1
        with:
          # Check available parameters in: https://github.com/avto-dev/markdown-lint/blob/master/action.yml
          config: 'docs/.markdownlint.json'
          args: 'docs/*.md'

      - name: Setup Ruby, JRuby and TruffleRuby
        timeout-minutes: ${{ fromJSON(env.GITHUB_STEP_TIMEOUT_SMALL) }}
        if: success()
        uses: ruby/setup-ruby@v1
        with:
          # Check available parameters in: https://github.com/ruby/setup-ruby/blob/master/action.yml
          ruby-version: '3.3'
          bundler-cache: false
          cache-version: 0

      - name: Setup Pages
        id: pages
        timeout-minutes: ${{ fromJSON(env.GITHUB_STEP_TIMEOUT_SMALL) }}
        if: success()
        uses: actions/configure-pages@v5
        with:
          # Check available parameters in: https://github.com/actions/configure-pages/blob/main/action.yml
          generator_config_file: docs/_config.yml

      - name: Install Ruby dependencies
        timeout-minutes: ${{ fromJSON(env.GITHUB_STEP_TIMEOUT_SMALL) }}
        if: success()
        run: |
          bundle config set path.system true;
          bundle install;

      - name: Build with Jekyll
        timeout-minutes: ${{ fromJSON(env.GITHUB_STEP_TIMEOUT_SMALL) }}
        if: success()
        env:
          JEKYLL_ENV: production
          PAGES_REPO_NWO: TiagoMSSantos/MobileRT
        # Outputs to the './_site' directory by default
        run: |
          bundle exec jekyll build --source docs/ --trace --verbose --baseurl "${{ steps.pages.outputs.base_path }}";

      - name: Doxygen build
        timeout-minutes: ${{ fromJSON(env.GITHUB_STEP_TIMEOUT_SMALL) }}
        if: success()
        uses: mattnotmitt/doxygen-action@v1
        with:
          # Check available parameters in: https://github.com/mattnotmitt/doxygen-action/blob/master/action.yml
          doxyfile-path: ".codedocs" # Path to Doxyfile (default is ./Doxyfile)
          working-directory: "." # Working directory (default is .)
          enable-latex: false # Flag to enable make-ing of the LaTeX part of the doxygen output (default is false)

      - name: Sync README with docker hub
        timeout-minutes: ${{ fromJSON(env.GITHUB_STEP_TIMEOUT_SMALL) }}
        if: success()
        uses: ms-jpq/sync-dockerhub-readme@v1
        with:
          # Check available parameters in: https://github.com/ms-jpq/sync-dockerhub-readme/blob/whale/action.yml
          username: ${{ secrets.DOCKERHUB_USERNAME }}
          password: ${{ secrets.DOCKERHUB_PASSWORD }}
          repository: ptpuscas/mobile_rt
          readme: "docs/README.md"

      - name: Validate site was generated
        timeout-minutes: ${{ fromJSON(env.GITHUB_STEP_TIMEOUT_SMALL) }}
        if: success()
        working-directory: .
        run: |
          ls -lahp ./_site/;
          ls -lahp ./_site/index.html;

      - name: Upload artifact
        # Automatically uploads an artifact from the './_site' directory by default
        uses: actions/upload-pages-artifact@v3
        with:
          # Check available parameters in: https://github.com/actions/upload-pages-artifact/blob/main/action.yml
          name: github-pages
          path: _site
          retention-days: 1

  # Deployment job (only on master branch)
  deploy:
    runs-on: ubuntu-latest
    needs: build
    if: ${{ contains(github.ref, 'master')}}
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}
    steps:
      - name: Deploy to GitHub Pages
        timeout-minutes: ${{ fromJSON(env.GITHUB_STEP_TIMEOUT_SMALL) }}
        id: deployment
        uses: actions/deploy-pages@v4
        with:
          # Check available parameters in: https://github.com/actions/deploy-pages/blob/main/action.yml
          artifact_name: github-pages
          error_count: 1