Skip to content

Commit

Permalink
Split gh-pages flow into check and deploy (#40)
Browse files Browse the repository at this point in the history
* Split actions for the pr check and deployment

* delete extra rights for token

* delete unnecessary trigger

* retun back the rights
  • Loading branch information
EgorPopelyaev committed May 15, 2024
1 parent d7ddc5a commit d4b2332
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 10 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/check-gh-pages.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Check Label Documentation

on:
pull_request:
workflow_dispatch:

# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true

# Default to bash
defaults:
run:
shell: bash

jobs:
build:
runs-on: ubuntu-latest

env:
MDBOOK_VERSION: 0.4.37 # https://github.com/rust-lang/mdBook/releases
TERA_VERSION: 0.2.4 # https://github.com/chevdor/tera-cli/release

steps:
- name: Checkout sources
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
with:
fetch-depth: 0

- name: Install Tools
run: |
wget -O ${{ runner.temp }}/mdbook.tar.gz https://github.com/rust-lang/mdBook/releases/download/v${MDBOOK_VERSION}/mdbook-v${MDBOOK_VERSION}-x86_64-unknown-linux-gnu.tar.gz && \
tar xf ${{ runner.temp }}/mdbook.tar.gz && mv mdbook /usr/local/bin && \
wget -O ${{ runner.temp }}/tera.deb https://github.com/chevdor/tera-cli/releases/download/v${TERA_VERSION}/tera-cli_linux_amd64.deb && \
sudo dpkg -i ${{ runner.temp }}/tera.deb
- name: Generate the doc
run: ./scripts/build-doc.sh

- name: Check
run: ls -al ./docs/src

- name: Setup Pages
id: pages
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5.0.0

- name: Render book
run: ./scripts/generate_book.sh

- name: Upload artifact
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1
with:
path: ./docs/book
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
name: Generate Label Documentation
name: Deploy Label Documentation

on:
push:
branches: [ main ]
pull_request:
workflow_dispatch:

# Allow one concurrent deployment
concurrency:
Expand All @@ -27,16 +25,14 @@ jobs:
runs-on: ubuntu-latest

env:
MDBOOK_VERSION: 0.4.21 # https://github.com/rust-lang/mdBook/releases
MDBOOK_VERSION: 0.4.37 # https://github.com/rust-lang/mdBook/releases
TERA_VERSION: 0.2.4 # https://github.com/chevdor/tera-cli/release

steps:
- name: Checkout sources
uses: actions/checkout@v3
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}

- name: Install Tools
run: |
Expand All @@ -53,13 +49,13 @@ jobs:

- name: Setup Pages
id: pages
uses: actions/configure-pages@v2
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5.0.0

- name: Render book
run: ./scripts/generate_book.sh

- name: Upload artifact
uses: actions/upload-pages-artifact@v1
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1
with:
path: ./docs/book

Expand All @@ -76,4 +72,4 @@ jobs:
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5

0 comments on commit d4b2332

Please sign in to comment.