Skip to content

Commit

Permalink
Deploy versioned docs (#260)
Browse files Browse the repository at this point in the history
  • Loading branch information
mondeja authored Nov 20, 2024
1 parent b5442b4 commit 485a936
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
14 changes: 14 additions & 0 deletions .github/actions/get-version/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Get project version
description: Get the version for the current project defined in the `leptos-fluent/Cargo.toml` file
outputs:
version:
description: Version of the project
value: ${{ steps.get-version.outputs.version }}
runs:
using: composite
steps:
- id: get-version
shell: sh
run: |
echo "version=$(grep -oP --color=never '^version = "\K[^"]+' leptos-fluent/Cargo.toml)" \
>> $GITHUB_OUTPUT
19 changes: 16 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -346,10 +346,11 @@ jobs:
- uses: actions/checkout@v4
- name: Setup Rust
uses: hecrj/setup-rust-action@v2
- name: Get project version
id: version
uses: ./.github/actions/get-version
- name: Update version
run: |
version=$(grep -oP --color=never '^version = "\K[^"]+' leptos-fluent/Cargo.toml)
sed -i "s/^leptos-fluent-macros = .*/leptos-fluent-macros = \"$version\"/" leptos-fluent/Cargo.toml
run: sed -i "s/^leptos-fluent-macros = .*/leptos-fluent-macros = \"${{ steps.version.outputs.version }}\"/" leptos-fluent/Cargo.toml
- name: Publish
run: |
cargo login ${{ secrets.CRATES_TOKEN }}
Expand Down Expand Up @@ -400,6 +401,9 @@ jobs:
uses: cargo-bins/cargo-binstall@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Get project version
id: version
uses: ./.github/actions/get-version
- name: Install mdbook
run: cargo binstall -y mdbook mdbook-admonish mdbook-toc
env:
Expand All @@ -409,8 +413,17 @@ jobs:
cd book
mdbook-admonish install .
mdbook build
# create versioned copy
cd ..
cp -r book/dist book/v${{ steps.version.outputs.version }}
- name: Deploy book
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./book/dist
- name: Deploy book v${{ steps.version.outputs.version }}
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./book/v${{ steps.version.outputs.version }}
destination_dir: v${{ steps.version.outputs.version }}

0 comments on commit 485a936

Please sign in to comment.