name: docs on: - push defaults: run: shell: bash jobs: publish-docs: if: startsWith(github.ref, 'refs/tags/') runs-on: macos-11 steps: - name: Get the version id: get_version run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} - uses: actions/checkout@v2 - uses: ruby/setup-ruby@v1 with: bundler-cache: true # runs 'bundle install' and caches installed gems automatically - name: Write tags manifest run: | echo ${{ steps.get_version.outputs.VERSION }} > docs/assets/versions.txt tags=`git ls-tree --name-only origin/gh-pages | egrep "^((([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?)(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?)$"` echo $tags >> docs/assets/versions.txt for version in $tags; do cp docs/assets/versions.txt $version/assets/ cat $version/assets/versions.txt done cat docs/assets/versions.txt - name: Build jekyll site run: | cd docs/ gem install bundler bundle install # Generate top-level docs bundle exec jekyll build \ --destination _latest # Generate versioned docs bundle exec jekyll build \ --baseurl ${{ steps.get_version.outputs.VERSION }} \ --destination ${{ steps.get_version.outputs.VERSION }} - name: Publish Latest Docs uses: JamesIves/github-pages-deploy-action@v4.2.2 with: branch: gh-pages folder: docs/_latest target-folder: . clean: false - name: Publish Versioned Docs uses: JamesIves/github-pages-deploy-action@v4.2.2 with: branch: gh-pages folder: docs/${{ steps.get_version.outputs.VERSION }} target-folder: ${{ steps.get_version.outputs.VERSION }} clean: false