back on main #22
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Cut Release | |
on: | |
push: | |
branches: | |
- "wasm-main" | |
paths: | |
- "crates/www/Cargo.toml" | |
- "crates/www/src/**" | |
- "Dockerfile" | |
- "crates/www/style/**" | |
- "crates/www/tailwind.config.js" | |
- "fly.toml" | |
- "crates/www/public/**" | |
jobs: | |
release: | |
name: Test, Release [Docker, GH] | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@nightly | |
with: | |
toolchain: nightly-2024-08-10 | |
targets: "wasm32-unknown-unknown" | |
- uses: superfly/flyctl-actions/setup-flyctl@master | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
# The prefix cache key, this can be changed to start a new cache manually. | |
prefix-key: "v0-rust" | |
# A cache key that is used instead of the automatic `job`-based key, | |
# and is stable over multiple jobs. | |
# default: empty | |
# shared-key: "" | |
- name: "Install cargo-leptos" | |
run: curl --proto '=https' --tlsv1.2 -LsSf https://leptos-rs.artifacts.axodotdev.host/cargo-leptos/v0.2.20/cargo-leptos-installer.sh | sh | |
- name: "install wasm-bindgen" | |
run: cargo install -f wasm-bindgen-cli --version 0.2.93 | |
- run: cargo leptos test --project www | |
- run: cargo leptos build --release --project www | |
env: | |
CDN_PATH: https://cdn.christopherbiscardi.com | |
LEPTOS_HASH_FILES: true | |
- uses: hustcer/setup-nu@v3 | |
with: | |
version: "0.96.1" | |
- name: Remove horizontal whitespace from hash.txt | |
shell: nu {0} | |
run: open crates/www/target/release/hash.txt | lines | parse "{key} {value}" | each {|it| $'($it.key)($in.value)' } | save -f crates/www/target/release/hash.txt | |
- name: cat hash.txt | |
shell: bash | |
run: cat crates/www/target/release/hash.txt | |
- name: Get current date | |
id: date | |
run: | | |
echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_ENV | |
- name: Publish Docker Image to Fly.io | |
run: flyctl deploy --build-only --push --image-label $IMAGE_LABEL | |
env: | |
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} | |
IMAGE_LABEL: gh-${{ env.date }}-${{ github.sha }} | |
- name: Tar static files | |
run: | | |
tar -czvf static-assets.tar.gz target/site | |
- name: Publish GitHub Release | |
id: gh-release | |
uses: softprops/action-gh-release@v2 | |
with: | |
name: gh-${{ env.date }}-${{ github.sha }} | |
fail_on_unmatched_files: true | |
target_commitish: wasm-main | |
tag_name: ${{env.date}}-${{ github.sha }} | |
token: ${{ secrets.RELEASE_TOKEN }} | |
files: | | |
Cargo.toml | |
target/release/www | |
static-assets.tar.gz | |
crates/www/target/release/hash.txt | |
fly.toml |