name: gh-pages on: push: branches: - main release: types: [published] env: CARGO_TERM_COLOR: always jobs: deploy: runs-on: ubuntu-latest outputs: tag_name: ${{ steps.prepare_tag.outputs.tag_name }} steps: - uses: actions/checkout@v2 - name: Setup mdBook uses: peaceiris/actions-mdbook@v1 with: mdbook-version: '0.4.7' - name: Prepare tag id: prepare_tag run: | TAG_NAME="${GITHUB_REF##*/}" echo "::set-output name=tag_name::${TAG_NAME}" # This builds the book in gh-pages-build. See https://github.com/rust-lang-nursery/mdBook/issues/698 - name: Build the guide run: mdbook build -d ../gh-pages-build guide env: PYO3_VERSION_TAG: ${{ steps.prepare_tag.outputs.tag_name }} # This adds the docs to gh-pages-build/doc - name: Build the doc run: | cargo doc --features="default num-bigint num-complex" --no-deps cp -r target/doc gh-pages-build/doc echo "" > gh-pages-build/doc/index.html - name: Deploy uses: peaceiris/actions-gh-pages@v3.7.0-8 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./gh-pages-build/ destination_dir: ${{ steps.prepare_tag.outputs.tag_name }} full_commit_message: 'Upload documentation for ${{ steps.prepare_tag.outputs.tag_name }}' release: needs: deploy runs-on: ubuntu-latest if: ${{ github.event_name == 'release' }} steps: - name: Create latest tag redirect env: TAG_NAME: ${{ needs.deploy.outputs.tag_name }} run: | mkdir public echo "" > public/index.html - name: Deploy uses: peaceiris/actions-gh-pages@v3.7.0-8 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./public/ full_commit_message: 'Release ${{ needs.deploy.outputs.tag_name }}' keep_files: true