Skip to content

Commit

Permalink
chore(releng): prepare release (#45)
Browse files Browse the repository at this point in the history
* chore: add release fields

* ci: run publish with dry-run

* ci: access registry via http

* ci: set commit user

* ci: switch to path

* ci: fetch with lib

* ci: add dummy token

* ci: write dummy token to file

* ci: enable publish for bridge

* ci: add more crates to publish

* ci: read from alternative registry

* ci: fix edit toml

* ci: write to temp file first

* ci: only modify backend

* ci: use echo -e

* ci: write to a temporary file

* ci: modify all crates

* chore: commit on switching registry
  • Loading branch information
futursolo authored Jan 15, 2023
1 parent cf4d849 commit e0a6c97
Show file tree
Hide file tree
Showing 6 changed files with 192 additions and 17 deletions.
132 changes: 132 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,138 @@ jobs:
cargo clippy --bin template-default-generated-server
working-directory: template-default-generated

publish:
name: Publish to crates.io
runs-on: ubuntu-latest
needs:
- lint
- rustfmt
- check-templates
steps:
- name: Checkout Project
uses: actions/checkout@v3

- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
components: rustfmt, clippy

- name: Restore Rust Cache
uses: Swatinem/rust-cache@v2

- name: Set Git Information
run: |
git config --global user.name "Stackable Actions"
git config --global user.email "actions@stackable.dummy"
- name: Prepare dry-run Registry
if: "!startsWith(github.ref, 'refs/tags/')"
run: |
cargo install cargo-http-registry
mkdir -p /tmp/dry-run-registry
nohup cargo-http-registry /tmp/dry-run-registry &
echo "CARGO_PUBLISH_EXTRA_ARGS=--registry=dry-run" >> $GITHUB_ENV
echo "[registries.dry-run]" >> ~/.cargo/config.toml
echo 'index = "file:///tmp/dry-run-registry"' >> ~/.cargo/config.toml
echo 'token = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"' >> ~/.cargo/config.toml
- name: Modify to publish to dry-run Registry
if: "!startsWith(github.ref, 'refs/tags/')"
run: |
cargo install toml-cli
toml set \
crates/stackable-backend/Cargo.toml \
dependencies.stackable-bridge.registry dry-run > /tmp/tempfile-cargo1
cat /tmp/tempfile-cargo1 > crates/stackable-backend/Cargo.toml
toml set \
crates/stackable-backend/Cargo.toml \
dependencies.stackable-core.registry dry-run > /tmp/tempfile-cargo1
cat /tmp/tempfile-cargo1 > crates/stackable-backend/Cargo.toml
toml set \
crates/stackable-frontend/Cargo.toml \
dependencies.stackable-bridge.registry dry-run > /tmp/tempfile-cargo1
cat /tmp/tempfile-cargo1 > crates/stackable-frontend/Cargo.toml
toml set \
crates/stackctl/Cargo.toml \
dependencies.stackable-core.registry dry-run > /tmp/tempfile-cargo1
cat /tmp/tempfile-cargo1 > crates/stackctl/Cargo.toml
git commit -a -m "chore: switch to dry-run registry"
- name: Prepare crates.io Registry
if: startsWith(github.ref, 'refs/tags/')
run: |
echo "CARGO_PUBLISH_EXTRA_ARGS=--token=${{ secrets.CRATES_IO_TOKEN }}" >> $GITHUB_ENV
- name: Run cargo publish for stackable-core
if: "!startsWith(github.ref, 'refs/tags/')"
run: |
cargo publish \
${{ env.CARGO_PUBLISH_EXTRA_ARGS }} \
--manifest-path crates/stackable-core/Cargo.toml
env:
RUSTFLAGS: "--cfg releasing"

- name: Wait for Registry to Refresh
run: sleep 30s
shell: bash

- name: Run cargo publish for stackable-bridge
if: "!startsWith(github.ref, 'refs/tags/')"
run: |
cargo publish \
${{ env.CARGO_PUBLISH_EXTRA_ARGS }} \
--manifest-path crates/stackable-bridge/Cargo.toml
env:
RUSTFLAGS: "--cfg releasing"

- name: Wait for Registry to Refresh
run: sleep 30s
shell: bash

- name: Run cargo publish for stackable-backend
if: "!startsWith(github.ref, 'refs/tags/')"
run: |
cargo publish \
${{ env.CARGO_PUBLISH_EXTRA_ARGS }} \
--manifest-path crates/stackable-backend/Cargo.toml
env:
RUSTFLAGS: "--cfg releasing"

- name: Wait for Registry to Refresh
run: sleep 30s
shell: bash

- name: Run cargo publish for stackable-frontend
if: "!startsWith(github.ref, 'refs/tags/')"
run: |
cargo publish \
${{ env.CARGO_PUBLISH_EXTRA_ARGS }} \
--manifest-path crates/stackable-frontend/Cargo.toml
env:
RUSTFLAGS: "--cfg releasing"

- name: Wait for Registry to Refresh
run: sleep 30s
shell: bash

- name: Run cargo publish for stackctl
if: "!startsWith(github.ref, 'refs/tags/')"
run: |
cargo publish \
${{ env.CARGO_PUBLISH_EXTRA_ARGS }} \
--manifest-path crates/stackctl/Cargo.toml
env:
RUSTFLAGS: "--cfg releasing"

publish-templates:
name: Publish Templates
runs-on: ubuntu-latest
Expand Down
14 changes: 11 additions & 3 deletions crates/stackable-backend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,17 @@
name = "stackable-backend"
version = "0.1.0"
edition = "2021"
rust-version = "1.65"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
rust-version = "1.66"
repository = "https://github.com/futursolo/stackable"
authors = [
"Kaede Hoshiakwa <futursolo@icloud.com>",
]
description = "The framework experience for Yew."
keywords = ["web", "wasm", "yew", "framework", "ssr"]
categories = ["wasm", "web-programming"]
readme = "../../README.md"
homepage = "https://github.com/futursolo/stackable"
license = "MIT OR Apache-2.0"

[dependencies]
futures = { version = "0.3", default-features = false, features = ["std"] }
Expand Down
14 changes: 11 additions & 3 deletions crates/stackable-bridge/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,17 @@
name = "stackable-bridge"
version = "0.1.0"
edition = "2021"
rust-version = "1.65"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
rust-version = "1.66"
repository = "https://github.com/futursolo/stackable"
authors = [
"Kaede Hoshiakwa <futursolo@icloud.com>",
]
description = "The framework experience for Yew."
keywords = ["web", "wasm", "yew", "framework", "ssr"]
categories = ["wasm", "web-programming"]
readme = "../../README.md"
homepage = "https://github.com/futursolo/stackable"
license = "MIT OR Apache-2.0"

[dependencies]
async-trait = "0.1.61"
Expand Down
13 changes: 11 additions & 2 deletions crates/stackable-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,17 @@
name = "stackable-core"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
rust-version = "1.66"
repository = "https://github.com/futursolo/stackable"
authors = [
"Kaede Hoshiakwa <futursolo@icloud.com>",
]
description = "The framework experience for Yew."
keywords = ["web", "wasm", "yew", "framework", "ssr"]
categories = ["wasm", "web-programming"]
readme = "../../README.md"
homepage = "https://github.com/futursolo/stackable"
license = "MIT OR Apache-2.0"

[dependencies]
serde = { version = "1", features = ["derive"] }
Expand Down
18 changes: 14 additions & 4 deletions crates/stackable-frontend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,29 @@
name = "stackable-frontend"
version = "0.1.0"
edition = "2021"
rust-version = "1.65"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
rust-version = "1.66"
repository = "https://github.com/futursolo/stackable"
authors = [
"Kaede Hoshiakwa <futursolo@icloud.com>",
]
description = "The framework experience for Yew."
keywords = ["web", "wasm", "yew", "framework", "ssr"]
categories = ["wasm", "web-programming"]
readme = "../../README.md"
homepage = "https://github.com/futursolo/stackable"
license = "MIT OR Apache-2.0"

[dependencies]
yew = { version = "0.20", features = ["csr", "hydration"] }
bounce = { version = "0.6", features = ["helmet"] }
yew-router = "0.17"
stackable-bridge = { version = "0.1.0", path = "../stackable-bridge" }
tracing = "0.1"
tracing-web = "0.1.2"
tracing-subscriber = { version = "0.3.16", default-features = false, features = ["time", "std", "fmt", "ansi"] }

# Stackable Components
stackable-bridge = { version = "0.1.0", path = "../stackable-bridge" }

[dependencies.web-sys]
version = "0.3"
features = ["Document"]
18 changes: 13 additions & 5 deletions crates/stackctl/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,17 @@
name = "stackctl"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
rust-version = "1.66"
repository = "https://github.com/futursolo/stackable"
authors = [
"Kaede Hoshiakwa <futursolo@icloud.com>",
]
description = "The framework experience for Yew."
keywords = ["web", "wasm", "yew", "framework", "ssr"]
categories = ["wasm", "web-programming"]
readme = "../../README.md"
homepage = "https://github.com/futursolo/stackable"
license = "MIT OR Apache-2.0"

[dependencies]
anyhow = "1.0.68"
Expand All @@ -18,14 +27,13 @@ futures = { version = "0.3", features = ["std", "async-await"], default-features
cargo_metadata = "0.15"
serde_json = "1.0.91"
dotenvy = "0.15.6"

time = "0.3"
rand = "0.8.5"
indicatif = "0.17.3"
console = "0.15.5"
reqwest = { version = "0.11.13", features = ["rustls-tls-webpki-roots"] }
tokio-stream = { version = "0.1.11", features = ["sync"] }
webbrowser = "0.8.4"

# Stackable Components
stackable-core = { version = "0.1.0", path = "../stackable-core" }
tokio-stream = { version = "0.1.11", features = ["sync"] }
webbrowser = "0.8.4"

0 comments on commit e0a6c97

Please sign in to comment.