Skip to content

Merge branch 'master' into master #1

Merge branch 'master' into master

Merge branch 'master' into master #1

Workflow file for this run

name: github pages
on:
push:
branches:
- master
tags:
- v*
jobs:
deploy:
runs-on: buildjet-4vcpu-ubuntu-2204
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v1
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- name: Install Forc
uses: actions-rs/cargo@v1
with:
command: install
args: --locked --debug --path ./forc
- name: Install Forc plugins
run: |
cargo install --locked --debug --path ./forc-plugins/forc-fmt
cargo install --locked --debug --path ./forc-plugins/forc-lsp
cargo install --locked --debug --path ./forc-plugins/forc-client
cargo install --locked --debug --path ./forc-plugins/forc-debug
cargo install --locked --debug --path ./forc-plugins/forc-doc
cargo install --locked --debug --path ./forc-plugins/forc-crypto
cargo install --locked --debug forc-explore
- name: Install mdbook-forc-documenter
uses: actions-rs/cargo@v1
with:
command: install
args: --locked --debug --path ./scripts/mdbook-forc-documenter
- name: Setup mdBook
uses: peaceiris/actions-mdbook@v1
with:
mdbook-version: "0.4.25"
- name: Build Sway book
run: MDBOOK_preprocessor__FORC_documenter__STRICT="true" mdbook build docs/book
- name: Build Sway reference
run: mdbook build docs/reference
- name: Build Sway std library
run: forc doc --manifest-path ./sway-lib-std
- name: Deploy master std
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./sway-lib-std/out/doc
destination_dir: master
if: github.ref == 'refs/heads/master'
- name: Deploy master book
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/book/book
destination_dir: master/book
if: github.ref == 'refs/heads/master'
- name: Deploy master reference
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/reference/book
destination_dir: master/reference
if: github.ref == 'refs/heads/master'
- name: Create master book redirect file
run: |
mkdir ./tmp
cat > ./tmp/index.html <<EOF
<!DOCTYPE html>
<meta charset="utf-8">
<meta http-equiv="refresh" content="0; URL=../master/book">
<link rel="canonical" href="../master/book">
EOF
if: github.ref == 'refs/heads/master'
- name: Deploy index.html redirect file to master
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./tmp
destination_dir: ./master
keep_files: true
if: github.ref == 'refs/heads/master'
- name: Get tag
id: branch_name
run: |
echo ::set-output name=BRANCH_NAME::${GITHUB_REF#refs/tags/}
if: startsWith(github.ref, 'refs/tags')
- name: Deploy book tag
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/book/book
destination_dir: ${{ steps.branch_name.outputs.BRANCH_NAME }}/book
if: startsWith(github.ref, 'refs/tags')
- name: Deploy reference tag
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/reference/book
destination_dir: ${{ steps.branch_name.outputs.BRANCH_NAME }}/reference
if: startsWith(github.ref, 'refs/tags')
- name: Deploy std tag
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./sway-lib-std/out/doc/std
destination_dir: ${{ steps.branch_name.outputs.BRANCH_NAME }}/std
if: startsWith(github.ref, 'refs/tags')
- name: Create tag book redirect file
run: |
mkdir ./tmp
cat > ./tmp/index.html <<EOF
<!DOCTYPE html>
<meta charset="utf-8">
<meta http-equiv="refresh" content="0; URL=../${{ steps.branch_name.outputs.BRANCH_NAME }}/book">
<link rel="canonical" href="../${{ steps.branch_name.outputs.BRANCH_NAME }}/book">
EOF
if: startsWith(github.ref, 'refs/tags')
- name: Deploy index.html redirect file to tag
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./tmp
destination_dir: ./${{ steps.branch_name.outputs.BRANCH_NAME }}
keep_files: true
if: startsWith(github.ref, 'refs/tags')
- name: Create latest HTML redirect file
if: startsWith(github.ref, 'refs/tags')
run: |
mkdir ./latest
cat > ./latest/index.html <<EOF
<!DOCTYPE html>
<meta charset="utf-8">
<meta http-equiv="refresh" content="0; URL=../${{ steps.branch_name.outputs.BRANCH_NAME }}/book">
<link rel="canonical" href="../${{ steps.branch_name.outputs.BRANCH_NAME }}/book">
EOF
- name: Set latest to point to tag
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./latest/
destination_dir: ./latest/
if: startsWith(github.ref, 'refs/tags')