Update main.rs #183
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: Deploy to GitHub Pages | |
on: | |
push: | |
branches: | |
- main | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
env: | |
PROJECT_TRUNK_VERSION: 'v0.17.5' | |
# Specify the primary crate of the project. | |
RUST_PRIMARY_CRATE: swim | |
jobs: | |
check: | |
uses: ./.github/workflows/check.yml | |
build-deploy: | |
name: Build and Deploy | |
needs: check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: Swatinem/rust-cache@v2 | |
- name: Install Rust | |
run: rustup show | |
- name: Install trunk | |
uses: jetli/[email protected] | |
with: | |
version: ${{ env.PROJECT_TRUNK_VERSION }} | |
- name: Install Tailwind CSS | |
run: npm install -g tailwindcss | |
- name: Build | |
run: trunk build --release --public-url /${{ github.event.repository.name }} | |
- name: Create documentation | |
run: cargo doc --release | |
- name: Merge documentation | |
run: | | |
rm -rf ./dist/docs | |
echo "<meta http-equiv=\"refresh\" content=\"0; url=$RUST_PRIMARY_CRATE\">" > ./target/doc/index.html | |
mkdir ./dist/docs | |
cp -r ./target/doc ./dist | |
- name: Deploy | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./dist |