| 1 |
name: gh-pages |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
branches: |
| 6 |
- master |
| 7 |
release: |
| 8 |
types: [published] |
| 9 |
|
| 10 |
env: |
| 11 |
CARGO_TERM_COLOR: always |
| 12 |
|
| 13 |
jobs: |
| 14 |
deploy: |
| 15 |
runs-on: ubuntu-latest |
| 16 |
outputs: |
| 17 |
tag_name: ${{ steps.prepare_tag.outputs.tag_name }} |
| 18 |
steps: |
| 19 |
- uses: actions/checkout@v3 |
| 20 |
|
| 21 |
|
| 22 |
- name: Build the doc |
| 23 |
run: | |
| 24 |
cargo doc --no-deps --all-features |
| 25 |
mkdir -p gh-pages-build |
| 26 |
cp -r target/doc gh-pages-build/doc |
| 27 |
echo "<meta http-equiv=refresh content=0;url=pyo3_async_runtimes/index.html>" > gh-pages-build/doc/index.html |
| 28 |
|
| 29 |
- name: Prepare tag |
| 30 |
id: prepare_tag |
| 31 |
run: | |
| 32 |
TAG_NAME="${GITHUB_REF##*/}" |
| 33 |
echo "::set-output name=tag_name::${TAG_NAME}" |
| 34 |
|
| 35 |
- name: Deploy |
| 36 |
uses: peaceiris/[email protected] |
| 37 |
with: |
| 38 |
github_token: ${{ secrets.GITHUB_TOKEN }} |
| 39 |
publish_dir: ./gh-pages-build/ |
| 40 |
destination_dir: ${{ steps.prepare_tag.outputs.tag_name }} |
| 41 |
full_commit_message: "Upload documentation for ${{ steps.prepare_tag.outputs.tag_name }}" |
| 42 |
|
| 43 |
release: |
| 44 |
needs: deploy |
| 45 |
runs-on: ubuntu-latest |
| 46 |
if: ${{ github.event_name == 'release' }} |
| 47 |
steps: |
| 48 |
- name: Create latest tag redirect |
| 49 |
env: |
| 50 |
TAG_NAME: ${{ needs.deploy.outputs.tag_name }} |
| 51 |
run: | |
| 52 |
mkdir public |
| 53 |
echo "<meta http-equiv=refresh content=0;url='$TAG_NAME/'>" > public/index.html |
| 54 |
|
| 55 |
- name: Deploy |
| 56 |
uses: peaceiris/[email protected] |
| 57 |
with: |
| 58 |
github_token: ${{ secrets.GITHUB_TOKEN }} |
| 59 |
publish_dir: ./public/ |
| 60 |
full_commit_message: "Release ${{ needs.deploy.outputs.tag_name }}" |
| 61 |
keep_files: true |