Skip to content

Commit

Permalink
ci: Deploy pages (#703)
Browse files Browse the repository at this point in the history
## fixes KILTprotocol/ticket#3583
Deploys master as default docs branch then each tag and develop are put
inside the root directory
Succeful deployment can be seen here
/~https://github.com/KILTprotocol/kilt-node/actions/runs/10595010314

## Metadata Diff to Develop Branch

<details>
<summary>Peregrine Diff</summary>

```
```

</details>

<details>
<summary>Spiritnet Diff</summary>

```
```

</details>

## Checklist:

- [ ] I have verified that the code works
- [ ] No panics! (checked arithmetic ops, no indexing `array[3]` use
`get(3)`, ...)
- [ ] I have verified that the code is easy to understand
  - [ ] If not, I have left a well-balanced amount of inline comments
- [ ] I have [left the code in a better
state](https://deviq.com/principles/boy-scout-rule)
- [ ] I have documented the changes (where applicable)
* Either PR or Ticket to update [the
Docs](/~https://github.com/KILTprotocol/docs)
    * Link the PR/Ticket here

---------

Co-authored-by: Antonio Antonino <antonio@kilt.io>
  • Loading branch information
ggera and ntn-x2 authored Sep 3, 2024
1 parent 872fc9d commit 5e9f744
Showing 1 changed file with 55 additions and 6 deletions.
61 changes: 55 additions & 6 deletions .github/workflows/publish-rustdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,30 @@ on:
types:
- completed

permissions:
contents: write
pages: write
id-token: write

concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true

jobs:
deploy-rustdocs:
name: Deploy rustdoc
build-rustdoc:
name: Build rustdoc
runs-on: ubuntu-latest
env:
DOCS_TARGET: target/doc
BRANCH: gh-pages
if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') }}

steps:
- name: Free Disk Space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true

- name: Checkout repository
uses: actions/checkout@v4

Expand All @@ -42,13 +53,51 @@ jobs:
docker run --rm \
-v "${GITHUB_WORKSPACE}:/workspace" \
-v "${HOME}/.cargo:/root/.cargo" \
-w /workspace \
-e RUSTDOCFLAGS='-D warnings' \
-w /workspace \
paritytech/ci-unified:bullseye-1.74.0 \
bash -c "cargo doc --all-features --no-deps --locked && chown -R $(id -u):$(id -g) ${{ env.DOCS_TARGET }}"
bash -c "
cargo doc --all-features --no-deps --locked && \
mv $DOCS_TARGET/help.html $DOCS_TARGET/index.html && \
chown -R $(id -u):$(id -g) $DOCS_TARGET"
- name: Deploy to GitHub Pages
- name: Set target folder for non-master branches
if: github.ref_name != 'master'
run: echo "TARGET_FOLDER=${{ github.ref_name }}" >> $GITHUB_ENV

- name: Push to gh-pages branch
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages-${{ github.ref_name }}
branch: ${{ env.BRANCH }}
folder: ${{ env.DOCS_TARGET }}
target-folder: ${{ env.TARGET_FOLDER }}


deploy-rustdoc:
name: Deploy rustdoc
environment:
name: gh-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build-rustdoc
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: gh-pages

- name: Setup Pages
uses: actions/configure-pages@v5

- name: Build with Jekyll
uses: actions/jekyll-build-pages@v1
with:
source: ./
destination: ./_site

- name: Upload artifact
uses: actions/upload-pages-artifact@v3

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

0 comments on commit 5e9f744

Please sign in to comment.