Add deploy action #2
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: "Dioxus Deploy" | |
author: "YuKun Liu <[email protected]>" | |
description: "Deploy your dioxus-web app online" | |
icon: "book" | |
color: "blue" | |
inputs: | |
buildMode: | |
description: "Build projects using different modes [default: 'release']" | |
required: true | |
default: "release" | |
toolchain: | |
description: "Build projects using a different rust toolchain [default: 'stable']" | |
required: true | |
default: "stable" | |
outDirectory: | |
description: "The `out_dir` property configured in Dioxus.toml [default: 'dist']" | |
required: true | |
default: "dist" | |
rootPath: | |
description: "Source code root path [default: '.']" | |
required: true | |
default: "." | |
runs: | |
using: "composite" | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions-rs/[email protected] | |
with: | |
toolchain: ${{ inputs.toolchain }} | |
profile: minimal | |
target: wasm32-unknown-unknown | |
override: true | |
- uses: Swatinem/rust-cache@v2 | |
- name: Install Dioxus-CLI | |
shell: bash | |
run: cargo install dioxus-cli | |
- name: Build Project 🎁 | |
shell: bash | |
run: cd ${{ inputs.rootPath }} && dx build --${{ inputs.buildMode }} && cp ./${{ inputs.outDirectory }}/index.html ./${{ inputs.outDirectory }}/404.html | |
- name: Deploy Project 🚀 | |
uses: JamesIves/[email protected] | |
with: | |
branch: gh-pages | |
folder: ${{ inputs.rootPath }}/${{ inputs.outDirectory }} | |
clean: false |