Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mondeja/leptos-fluent
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.1.17
Choose a base ref
...
head repository: mondeja/leptos-fluent
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Loading
Showing with 10,234 additions and 5,807 deletions.
  1. +14 −0 .github/actions/get-version/action.yml
  2. +166 −64 .github/workflows/ci.yml
  3. +2 −0 .gitignore
  4. +0 −7 .markdown-link-check.json
  5. +5 −15 .pre-commit-config.yaml
  6. +336 −10 CHANGELOG.md
  7. +17 −17 CONTRIBUTING.md
  8. +1,243 −1,331 Cargo.lock
  9. +22 −13 Cargo.toml
  10. +1 −1 LICENSE.md → LICENSE
  11. +31 −27 README.md
  12. +2 −1 book/src/SUMMARY.md
  13. +233 −0 book/src/advanced-usage.md
  14. +23 −12 book/src/basic-usage.md
  15. +4 −4 book/src/checking-translations.md
  16. +13 −37 book/src/faqs.md
  17. +31 −29 book/src/install.md
  18. +3 −32 book/src/intro.md
  19. +43 −31 book/src/languages.md
  20. +303 −162 book/src/leptos_fluent.md
  21. +39 −26 book/src/strategies.md
  22. +0 −20 end2end/Cargo.toml
  23. +0 −12 end2end/tests-helpers/Cargo.toml
  24. +0 −63 end2end/tests-helpers/src/lib.rs
  25. +0 −47 end2end/tests/cookie.rs
  26. +0 −55 end2end/tests/csr_complete.rs
  27. +0 −40 end2end/tests/localstorage.rs
  28. +0 −64 end2end/tests/url_param.rs
  29. +0 −54 end2end/tests/url_param_to_cookie.rs
  30. +0 −54 end2end/tests/url_param_to_localstorage.rs
  31. +6 −4 examples/csr-complete/Cargo.toml
  32. +30 −14 examples/csr-complete/src/lib.rs
  33. +1 −4 examples/csr-complete/src/main.rs
  34. +6 −3 examples/csr-minimal/Cargo.toml
  35. +2 −0 examples/csr-minimal/locales/en/main.ftl
  36. +2 −0 examples/csr-minimal/locales/es/main.ftl
  37. +24 −8 examples/csr-minimal/src/lib.rs
  38. +1 −1 examples/csr-minimal/src/main.rs
  39. +13 −22 examples/ssr-hydrate-actix/Cargo.toml
  40. +0 −6 examples/ssr-hydrate-actix/README.md
  41. +0 −7 examples/ssr-hydrate-actix/index.html
  42. +27 −24 examples/ssr-hydrate-actix/src/app.rs
  43. +1 −1 examples/ssr-hydrate-actix/src/lib.rs
  44. +38 −25 examples/ssr-hydrate-actix/src/main.rs
  45. +16 −23 examples/ssr-hydrate-axum/Cargo.toml
  46. +0 −6 examples/ssr-hydrate-axum/README.md
  47. +0 −7 examples/ssr-hydrate-axum/index.html
  48. +1 −5 examples/ssr-hydrate-axum/locales/en/main.ftl
  49. +1 −5 examples/ssr-hydrate-axum/locales/es/main.ftl
  50. +47 −30 examples/ssr-hydrate-axum/src/app.rs
  51. +0 −87 examples/ssr-hydrate-axum/src/error_template.rs
  52. +0 −58 examples/ssr-hydrate-axum/src/fileserv.rs
  53. +1 −4 examples/ssr-hydrate-axum/src/lib.rs
  54. +18 −28 examples/ssr-hydrate-axum/src/main.rs
  55. +0 −25 examples/system-gtk/Cargo.toml
  56. +0 −14 examples/system-gtk/README.md
  57. +0 −3 examples/system-gtk/build.rs
  58. +0 −1 examples/system-gtk/locales/en/main.ftl
  59. +0 −1 examples/system-gtk/locales/es/main.ftl
  60. +0 −119 examples/system-gtk/src/main.rs
  61. +10 −6 leptos-fluent-macros/Cargo.toml
  62. +1 −3 leptos-fluent-macros/README.md
  63. +30 −2 leptos-fluent-macros/src/exprpath.rs
  64. +769 −0 leptos-fluent-macros/src/fluent_entries.rs
  65. +1 −1 leptos-fluent-macros/src/fluent_resources.rs
  66. +46 −41 leptos-fluent-macros/src/languages.rs
  67. +841 −1,021 leptos-fluent-macros/src/lib.rs
  68. +863 −439 leptos-fluent-macros/src/loader.rs
  69. +1,644 −0 leptos-fluent-macros/src/tr_macros.rs
  70. +8 −11 leptos-fluent-macros/src/{translations_checker/mod.rs → translations_checker.rs}
  71. +0 −414 leptos-fluent-macros/src/translations_checker/fluent_entries.rs
  72. +0 −600 leptos-fluent-macros/src/translations_checker/tr_macros.rs
  73. +113 −0 leptos-fluent-macros/src/translations_filler.rs
  74. +0 −17 leptos-fluent-macros/tests/ui/leptos_fluent/fail/check_translations_cfg_feature.stderr
  75. +0 −13 leptos-fluent-macros/tests/ui/leptos_fluent/fail/empty.rs
  76. +0 −5 leptos-fluent-macros/tests/ui/leptos_fluent/fail/empty_value.stderr
  77. +0 −5 leptos-fluent-macros/tests/ui/leptos_fluent/fail/invalid_parameter.stderr
  78. +0 −9 leptos-fluent-macros/tests/ui/leptos_fluent/fail/locales_required.stderr
  79. 0 leptos-fluent-macros/tests/ui/leptos_fluent/nightly/fail/.keep
  80. +35 −0 leptos-fluent-macros/tests/ui/leptos_fluent/nightly/pass/check_translations_cfg_feature.rs
  81. +19 −9 leptos-fluent-macros/tests/ui/leptos_fluent/{ → nightly}/pass/check_translations_cfg_not_debug.rs
  82. +14 −6 ...-fluent-macros/tests/ui/leptos_fluent/{ → nightly}/pass/compile_time_exprpath_target_predicate.rs
  83. +22 −0 leptos-fluent-macros/tests/ui/leptos_fluent/nightly/pass/empty_translations.rs
  84. +13 −5 leptos-fluent-macros/tests/ui/leptos_fluent/{ → nightly}/pass/minimal.rs
  85. +13 −5 leptos-fluent-macros/tests/ui/leptos_fluent/{ → nightly}/pass/set_to_url_param_cfg_feature.rs
  86. +13 −5 leptos-fluent-macros/tests/ui/leptos_fluent/{ → nightly}/pass/struct_field_init_shorthand.rs
  87. +270 −0 leptos-fluent-macros/tests/ui/leptos_fluent/nightly/pass/tr_macros_001.rs
  88. +14 −0 leptos-fluent-macros/tests/ui/leptos_fluent/nightly/pass/tr_macros_basic.rs
  89. +12 −4 ...s-fluent-macros/tests/ui/leptos_fluent/{fail/empty_value.rs → stable/fail/double_curly_braces.rs}
  90. +13 −0 leptos-fluent-macros/tests/ui/leptos_fluent/stable/fail/double_curly_braces.stderr
  91. +13 −5 leptos-fluent-macros/tests/ui/leptos_fluent/{ → stable}/fail/empty_parameter.rs
  92. +2 −2 leptos-fluent-macros/tests/ui/leptos_fluent/{ → stable}/fail/empty_parameter.stderr
  93. +31 −0 leptos-fluent-macros/tests/ui/leptos_fluent/stable/fail/empty_value.rs
  94. +5 −0 leptos-fluent-macros/tests/ui/leptos_fluent/stable/fail/empty_value.stderr
  95. +13 −5 leptos-fluent-macros/tests/ui/leptos_fluent/{ → stable}/fail/invalid_parameter.rs
  96. +5 −0 leptos-fluent-macros/tests/ui/leptos_fluent/stable/fail/invalid_parameter.stderr
  97. +31 −0 leptos-fluent-macros/tests/ui/leptos_fluent/stable/fail/invalid_str_as_litbool.rs
  98. +5 −0 leptos-fluent-macros/tests/ui/leptos_fluent/stable/fail/invalid_str_as_litbool.stderr
  99. +16 −8 ...ros/tests/ui/leptos_fluent/{fail/check_translations_cfg_feature.rs → stable/fail/invalid_type.rs}
  100. +21 −0 leptos-fluent-macros/tests/ui/leptos_fluent/stable/fail/invalid_type.stderr
  101. +13 −5 leptos-fluent-macros/tests/ui/leptos_fluent/{ → stable}/fail/locales_required.rs
  102. +10 −0 leptos-fluent-macros/tests/ui/leptos_fluent/stable/fail/locales_required.stderr
  103. +18 −0 leptos-fluent-macros/tests/ui/leptos_fluent/stable/fail/only_children.rs
  104. +3 −5 leptos-fluent-macros/tests/ui/leptos_fluent/{fail/empty.stderr → stable/fail/only_children.stderr}
  105. +9 −0 leptos-fluent-macros/tests/ui/leptos_fluent/stable/fail/tr_macros_ident_id.rs
  106. +15 −0 leptos-fluent-macros/tests/ui/leptos_fluent/stable/fail/tr_macros_ident_id.stderr
  107. +11 −0 leptos-fluent-macros/tests/ui/leptos_fluent/stable/fail/tr_macros_invalid_types.rs
  108. +30 −0 leptos-fluent-macros/tests/ui/leptos_fluent/stable/fail/tr_macros_invalid_types.stderr
  109. +13 −5 leptos-fluent-macros/tests/ui/leptos_fluent/{ → stable}/pass/complete.rs
  110. +13 −5 ..._fluent/{pass/multiple_cfg_conditional_cheks.rs → stable/pass/multiple_cfg_conditional_checks.rs}
  111. +11 −7 leptos-fluent/Cargo.toml
  112. +31 −27 leptos-fluent/README.md
  113. +2 −2 leptos-fluent/src/cookie.rs
  114. +780 −280 leptos-fluent/src/lib.rs
  115. +3 −3 leptos-fluent/src/localstorage.rs
  116. +81 −0 leptos-fluent/src/sessionstorage.rs
  117. +6 −6 leptos-fluent/src/url.rs
  118. +5 −0 lychee.toml
  119. +1 −0 rust-toolchain.toml
  120. +14 −0 tests/Cargo.toml
  121. +1 −1 { → tests}/end2end/.pre-commit-config.yaml
  122. +25 −0 tests/end2end/Cargo.toml
  123. +6 −4 {end2end/tests → tests/end2end}/TODO.md
  124. +14 −0 tests/end2end/helpers/Cargo.toml
  125. +45 −0 tests/end2end/helpers/src/lib.rs
  126. +16 −0 tests/end2end/initial-language-from-navigator/Cargo.toml
  127. +47 −0 tests/end2end/initial-language-from-navigator/tests/initial_language_from_navigator.rs
  128. +11 −0 tests/end2end/initial-language-from-navigator/webdriver.json
  129. +17 −0 tests/end2end/set-language-to-cookie/Cargo.toml
  130. +49 −0 tests/end2end/set-language-to-cookie/tests/set_language_to_cookie.rs
  131. +11 −0 tests/end2end/set-language-to-cookie/webdriver.json
  132. +17 −0 tests/end2end/set-language-to-localstorage/Cargo.toml
  133. +49 −0 tests/end2end/set-language-to-localstorage/tests/set_language_to_localstorage.rs
  134. +11 −0 tests/end2end/set-language-to-localstorage/webdriver.json
  135. +17 −0 tests/end2end/set-language-to-sessionstorage/Cargo.toml
  136. +52 −0 tests/end2end/set-language-to-sessionstorage/tests/set_language_to_localstorage.rs
  137. +11 −0 tests/end2end/set-language-to-sessionstorage/webdriver.json
  138. +83 −0 tests/end2end/tests/context_outside_reactive_ownership_tree.rs
  139. +58 −0 tests/end2end/tests/cookie.rs
  140. +33 −22 { → tests}/end2end/tests/cookie_to_localstorage.rs
  141. +75 −0 tests/end2end/tests/csr_complete.rs
  142. +24 −9 { → tests}/end2end/tests/csr_minimal.rs
  143. +50 −0 tests/end2end/tests/localstorage.rs
  144. +33 −22 { → tests}/end2end/tests/localstorage_to_cookie.rs
  145. +71 −0 tests/end2end/tests/localstorage_to_sessionstorage.rs
  146. +50 −0 tests/end2end/tests/sessionstorage.rs
  147. +65 −0 tests/end2end/tests/sessionstorage_to_cookie.rs
  148. +65 −0 tests/end2end/tests/sessionstorage_to_localstorage.rs
  149. +73 −0 tests/end2end/tests/url_param.rs
  150. +65 −0 tests/end2end/tests/url_param_to_cookie.rs
  151. +65 −0 tests/end2end/tests/url_param_to_localstorage.rs
  152. +123 −0 tests/src/book.rs
  153. +155 −0 tests/src/leptos_fluent.rs
  154. +6 −0 tests/src/lib.rs
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
230 changes: 166 additions & 64 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -33,10 +33,7 @@ jobs:
strategy:
fail-fast: false
matrix:
process:
- lint
- check-all-features
- build-all-features
job: [lint, check-all-features, build-all-features]
steps:
- uses: actions/checkout@v4
- name: Get toolchain
@@ -62,13 +59,14 @@ jobs:
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}-${{ hashFiles('**/Cargo.lock') }}
~/.cache/pre-commit
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}-${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('**/.pre-commit-config.yaml') }}
- name: Install libgtk
run: |
sudo apt-get update
sudo apt-get install -y libgtk-4-dev
- name: Lint
if: matrix.process == 'lint'
if: matrix.job == 'lint'
uses: nick-fields/retry@v3
with:
timeout_minutes: 25
@@ -77,18 +75,55 @@ jobs:
warning_on_retry: false
command: pre-commit run --all-files --show-diff-on-failure
- name: Check all features
if: matrix.process == 'check-all-features'
if: matrix.job == 'check-all-features'
run: |
pre-commit run --all-files --verbose \
--config end2end/.pre-commit-config.yaml \
--config tests/end2end/.pre-commit-config.yaml \
cargo-check-all-features
- name: Build all features
if: matrix.process == 'build-all-features'
if: matrix.job == 'build-all-features'
run: |
pre-commit run --all-files --verbose \
--config end2end/.pre-commit-config.yaml \
--config tests/end2end/.pre-commit-config.yaml \
cargo-build-all-features
lychee:
name: Check URLs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Restore lychee cache
uses: actions/cache@v4
with:
path: .lycheecache
key: cache-lychee-${{ github.sha }}
restore-keys: cache-lychee-
- name: Run Lychee
uses: lycheeverse/lychee-action@v2
with:
args: "--cache --max-cache-age 1d ."

cargo-machete:
name: Check for unused dependencies
needs: check-toolchain-is-stable
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get toolchain
id: toolchain
uses: ./.github/actions/get-toolchain
- name: Setup Rust
uses: hecrj/setup-rust-action@v2
with:
rust-version: ${{ steps.toolchain.outputs.channel }}
profile: minimal
- name: Install cargo-machete
uses: taiki-e/install-action@v2
with:
tool: cargo-machete
- name: Run cargo-machete
run: cargo machete --skip-target-dir

build-book:
name: Build book
needs: check-toolchain-is-stable
@@ -124,29 +159,34 @@ jobs:
strategy:
fail-fast: false
matrix:
runs-on:
- ubuntu-latest
- macos-latest
- windows-latest
include:
- runs-on: ubuntu-latest
toolchain: stable
- runs-on: macos-latest
toolchain: stable
- runs-on: windows-latest
toolchain: stable
- runs-on: ubuntu-latest
toolchain: nightly
- runs-on: macos-latest
toolchain: nightly
steps:
- uses: actions/checkout@v4
- name: Get toolchain
id: toolchain
uses: ./.github/actions/get-toolchain
- name: Change toolchain to nightly
if: matrix.toolchain == 'nightly'
uses: ./.github/actions/set-toolchain
with:
channel: nightly
- name: Setup Rust
uses: hecrj/setup-rust-action@v2
with:
rust-version: ${{ steps.toolchain.outputs.channel }}
rust-version: ${{ matrix.toolchain }}
profile: minimal
targets: wasm32-unknown-unknown
- name: Install cargo binstall
uses: cargo-bins/cargo-binstall@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install wasm-pack
run: cargo binstall -y wasm-pack
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: taiki-e/install-action@v2
with:
tool: wasm-pack
- name: Cache dependencies
uses: actions/cache@v4
with:
@@ -156,7 +196,13 @@ jobs:
target
key: ${{ runner.os }}-cargo-unit-${{ hashFiles('**/Cargo.toml') }}-${{ hashFiles('**/Cargo.lock') }}
- name: Run unit tests
run: cargo test -p leptos-fluent -p leptos-fluent-macros
shell: bash
run: |
args=""
if [ "${{ matrix.toolchain }}" == "nightly" ]; then
args="--features=leptos-fluent/nightly,leptos-fluent-macros/nightly,leptos/nightly"
fi
cargo test $args -p leptos-fluent -p leptos-fluent-macros -p leptos-fluent-tests
end2end-tests:
needs: check-toolchain-is-stable
@@ -187,14 +233,12 @@ jobs:
rust-version: ${{ steps.toolchain.outputs.channel }}
profile: minimal
targets: wasm32-unknown-unknown
- name: Install cargo binstall
uses: cargo-bins/cargo-binstall@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install wasm-pack
run: cargo binstall -y wasm-pack
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: taiki-e/install-action@v2
with:
tool: wasm-pack
- name: Install wasm-pack-test-all
run: cargo install --force wasm-pack-test-all
- name: Cache dependencies
uses: actions/cache@v4
with:
@@ -210,11 +254,10 @@ jobs:
max_attempts: 3
retry_wait_seconds: 1
warning_on_retry: false
command: |
cd end2end
wasm-pack test --headless --${{ matrix.browser }}
shell: bash
command: wasm-pack-test-all tests/end2end --${{ matrix.browser }} --headless

build-example:
build-examples:
needs: check-toolchain-is-stable
name: Build example
runs-on: ${{ matrix.runs-on }}
@@ -226,7 +269,7 @@ jobs:
- csr-complete
- ssr-hydrate-actix
- ssr-hydrate-axum
- system-gtk
# TODO: re-add 'ssr-islands-axum' and 'system-gtk'
toolchain:
- stable
- nightly
@@ -249,38 +292,52 @@ jobs:
rust-version: ${{ steps.toolchain.outputs.channel }}
profile: minimal
targets: wasm32-unknown-unknown
- name: Install cargo binstall
uses: cargo-bins/cargo-binstall@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install trunk
if: startsWith(matrix.example, 'csr')
run: cargo binstall -y trunk
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install cargo-leptos
if: startsWith(matrix.example, 'ssr')
run: cargo binstall -y cargo-leptos
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Cache dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
~/.cargo/bin
target
key: ${{ runner.os }}-cargo-${{ matrix.example }}-${{ hashFiles('**/Cargo.toml') }}-${{ hashFiles('**/Cargo.lock') }}-${{ matrix.toolchain }}
- name: Install trunk
if: startsWith(matrix.example, 'csr')
uses: taiki-e/install-action@v2
with:
tool: trunk
- name: Install cargo binstall
if: startsWith(matrix.example, 'ssr')
uses: cargo-bins/cargo-binstall@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install cargo-leptos
if: startsWith(matrix.example, 'ssr')
run: |
if ! command -v cargo-leptos &> /dev/null; then
cargo binstall -y cargo-leptos
else
echo "cargo-leptos is already installed"
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Get build features
id: build-features
run: |
option=$([ "${{ matrix.toolchain }}" == "nightly" ] && echo "--features=leptos-fluent/nightly" || echo "")
echo "features=$option" >> $GITHUB_OUTPUT
- name: Build with trunk
if: startsWith(matrix.example, 'csr')
run: |
cd examples/${{ matrix.example }}
trunk build --release ${{ steps.build-features.outputs.features }}
# Sometimes trunk fails to download wasm-opt and other tools, so we retry
uses: nick-fields/retry@v3
with:
timeout_minutes: 20
max_attempts: 3
retry_wait_seconds: 2
warning_on_retry: false
command: |
cd examples/${{ matrix.example }}
trunk build --release ${{ steps.build-features.outputs.features }}
- name: Build with cargo-leptos
if: startsWith(matrix.example, 'ssr')
run: |
@@ -300,17 +357,49 @@ jobs:
cd examples/${{ matrix.example }}
cargo build --release ${{ steps.build-features.outputs.features }}
report-type-sizes:
needs:
- unit-tests
- build-book
name: Report type sizes
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set nightly toolchain
uses: ./.github/actions/set-toolchain
with:
channel: nightly
- name: Setup Rust
uses: hecrj/setup-rust-action@v2
with:
rust-version: nightly
profile: minimal
- name: leptos-fluent type sizes
run: |
cd leptos-fluent
cargo +nightly rustc -- -Zprint-type-sizes > ../leptos-fluent-type-sizes.log
cat ../leptos-fluent-type-sizes.log
- name: leptos-fluent-macros type sizes
run: |
cd leptos-fluent-macros
cargo +nightly rustc -- -Zprint-type-sizes > ../leptos-fluent-macros-type-sizes.log
cat ../leptos-fluent-macros-type-sizes.log
- name: Upload type sizes
uses: actions/upload-artifact@v4
with:
name: type-sizes
path: |
leptos-fluent-type-sizes.log
leptos-fluent-macros-type-sizes.log
test-release-leptos-fluent-macros:
needs:
- qa
- unit-tests
- end2end-tests
- build-example
- build-examples
- build-book
if: |
'${{ github.event.pull_request.user.login }}' == 'mondeja' ||
startsWith(github.ref, 'refs/tags/') ||
github.ref == 'refs/heads/master'
if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master'
name: Test leptos-fluent-macros release
runs-on: ubuntu-latest
steps:
@@ -347,10 +436,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 }}
@@ -379,7 +469,7 @@ jobs:
name: ${{ steps.tag.outputs.title }}
tag_name: ${{ steps.tag.outputs.title }}
body: |
See [CHANGELOG](https://github.com/mondeja/leptos-fluent/blob/master/CHANGELOG.md).
See [CHANGELOG](https://github.com/mondeja/leptos-fluent/blob/master/CHANGELOG.md)
draft: false
prerelease: false

@@ -401,6 +491,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:
@@ -410,8 +503,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 }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -4,3 +4,5 @@ dist/
.prettier-cache
/book/book
/leptos-fluent-macros/wip/
*.txt
*.log
Loading