Compare commits
No commits in common. "pages" and "main" have entirely different histories.
34
.forgejo/workflows/publish.yaml
Normal file
34
.forgejo/workflows/publish.yaml
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
on: [push]
|
||||||
|
jobs:
|
||||||
|
test_checkout:
|
||||||
|
runs-on: docker
|
||||||
|
container:
|
||||||
|
image: rust:slim-bookworm
|
||||||
|
steps:
|
||||||
|
- run: apt-get update -y && apt-get install -y git curl
|
||||||
|
- run: |
|
||||||
|
curl -L https://github.com/trunk-rs/trunk/releases/download/v0.19.1/trunk-x86_64-unknown-linux-gnu.tar.gz | tar -xzf-
|
||||||
|
mv trunk /
|
||||||
|
- run: rustup target add wasm32-unknown-unknown
|
||||||
|
- run: |
|
||||||
|
TOKEN=$(echo -n "x-access-token:${GITHUB_TOKEN}" | base64)
|
||||||
|
mkdir -p "${GITHUB_WORKSPACE}"
|
||||||
|
cd "${GITHUB_WORKSPACE}"
|
||||||
|
git init
|
||||||
|
git remote add origin "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}"
|
||||||
|
git -c http.extraHeader="Authorization: Basic ${TOKEN}" fetch origin "${GITHUB_SHA}"
|
||||||
|
git checkout "${GITHUB_SHA}"
|
||||||
|
ls
|
||||||
|
- run: /trunk build --release --public-url '.'
|
||||||
|
- run: |
|
||||||
|
cd dist
|
||||||
|
git init
|
||||||
|
git config user.email "ci_action@example.com"
|
||||||
|
git config user.name "CI"
|
||||||
|
git remote add origin "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}"
|
||||||
|
TOKEN=$(echo -n "x-access-token:${GITHUB_TOKEN}" | base64)
|
||||||
|
git -c http.extraHeader="Authorization: Basic ${TOKEN}" push origin -d pages || true
|
||||||
|
git checkout -b pages
|
||||||
|
git add *
|
||||||
|
git commit -m "gen pages"
|
||||||
|
git -c http.extraHeader="Authorization: Basic ${TOKEN}" push -u origin pages
|
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
/target
|
||||||
|
/dist
|
1158
Cargo.lock
generated
Normal file
1158
Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load diff
9
Cargo.toml
Normal file
9
Cargo.toml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
[package]
|
||||||
|
name = "tst"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
yew = { version = "0.21.0", features = ["csr"] }
|
24
README.md
Normal file
24
README.md
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
# Test Pages
|
||||||
|
|
||||||
|
Test with page generation. Juste a small yew app.
|
||||||
|
|
||||||
|
The generated pages are available here: <https://histausse.page.mineau.eu/tst_pages/>
|
||||||
|
|
||||||
|
# Gen pages:
|
||||||
|
|
||||||
|
CF <https://git.mineau.eu/histausse/tst_pages/src/branch/main/.forgejo/workflows/publish.yaml>
|
||||||
|
|
||||||
|
```
|
||||||
|
git clone <repo>
|
||||||
|
trunk build --release --public-url '.'
|
||||||
|
cd dist
|
||||||
|
git init
|
||||||
|
git remote add origin <repo>
|
||||||
|
# remove old pages branch
|
||||||
|
git push origin -d pages
|
||||||
|
git checkout -b pages
|
||||||
|
git add *
|
||||||
|
git commit -m "gen pages"
|
||||||
|
# push new pages branch
|
||||||
|
git push -u origin pages
|
||||||
|
```
|
11
index.html
11
index.html
|
@ -1 +1,10 @@
|
||||||
<!doctype html><link as=fetch crossorigin href=./tst-8824db6c28d8c006_bg.wasm integrity=sha384-nbiKnGDYF5z4WtMY2tUyv7NUNKSbMI2t7KjaDjnn-1syVWjC2QtQneWCiMFa7li_ rel=preload type=application/wasm><link crossorigin href=./tst-8824db6c28d8c006.js integrity=sha384-L_XmEoy7Xl8nhWNcrO3Z0wZ2ucBhdlYUWCRJuTIdu6IjL3LNvWpPFGDH1tHHBt9N rel=modulepreload></head><body><h1>Hello world</h1><p>This is the main branch.</p><script type=module>import a,*as b from"./tst-8824db6c28d8c006.js";a(`./tst-8824db6c28d8c006_bg.wasm`);window.wasmBindings=b</script></body></html>
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<h1>Hello world</h1>
|
||||||
|
|
||||||
|
<p>This is the main branch.</p>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
25
src/main.rs
Normal file
25
src/main.rs
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
use yew::prelude::*;
|
||||||
|
|
||||||
|
#[function_component]
|
||||||
|
fn App() -> Html {
|
||||||
|
let counter = use_state(|| 283870u64);
|
||||||
|
let onclick = {
|
||||||
|
let counter = counter.clone();
|
||||||
|
move |_| {
|
||||||
|
let value = (*counter * 989_909) % 1_212_149;
|
||||||
|
counter.set(value);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
html! {
|
||||||
|
<div>
|
||||||
|
<h3>{ "Pseudo Random Generator" }</h3>
|
||||||
|
<button {onclick}>{ "next" }</button>
|
||||||
|
<p>{ *counter }</p>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
yew::Renderer::<App>::new().render();
|
||||||
|
}
|
File diff suppressed because one or more lines are too long
Binary file not shown.
Loading…
Reference in a new issue