ember-cli/ember-cli

View on GitHub
.github/workflows/docs.yml

Summary

Maintainability
Test Coverage
name: 'Docs'

on:
  push:
    tags:
      - 'v*'
  workflow_dispatch:
    inputs:
      version:
        required: true
        type: string
        description: 'Specify the released version of ember-cli to use to generate and deploy documentation. Should be full tag name, including the leading "v"'

env:
  GIT_NAME: 'github-actions[bot]'
  GIT_EMAIL: 'github-actions+bot@users.noreply.github.com'

jobs:
  build:
    name: Build docs
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          ref: ${{ github.event.inputs.version || github.ref }}
      - uses: actions/setup-node@v4
        with:
          node-version: 18.x
          cache: 'yarn'

      - run: yarn install --frozen-lockfile --non-interactive
      - run: yarn docs
      - name: Upload docs artifact
        uses: actions/upload-artifact@v3
        with:
          name: docs (${{ github.event.inputs.version || github.ref }})
          path: docs/build
  deploy:
    name: Deploy docs
    runs-on: ubuntu-latest
    needs: [build]
    steps:
      - uses: actions/checkout@v4
        with:
          repository: 'ember-learn/ember-cli.github.io'
          ssh-key: ${{ secrets.DOCS_DEPLOY_KEY }}
          branch: master
      - name: Download docs artifact
        uses: actions/download-artifact@v3
        with:
          name: docs (${{ github.event.inputs.version || github.ref }})
          path: api
      - name: Commit
        run: |
            git config --local user.email "${{ env.GIT_EMAIL }}"
            git config --local user.name "${{ env.GIT_NAME }}"
            git add api
            COMMIT_MESSAGE="Update docs for ${{ github.event.inputs.version || github.ref }}
            
            ---
          
            This commit was automatically generated by the ember-cli documentation update process.
          
            Commit:  $GITHUB_REPOSITORY@$GITHUB_SHA
            Script:  https://github.com/$GITHUB_REPOSITORY/blob/$GITHUB_SHA/.github/workflows/docs.yml
            Logs:    https://github.com/$GITHUB_REPOSITORY/commit/$GITHUB_SHA/checks"            
          
            git commit --allow-empty -m "$COMMIT_MESSAGE"
      - name: Push
        run: |
          git push -f origin HEAD:refs/heads/master