fix: apt-get update in docs CI #205
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 documentation | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write # To push a branch | |
pages: write # To push to a GitHub Pages site | |
id-token: write # To update the deployment status | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Store version in environment | |
run: | | |
TAG=$(git describe --tags --always --abbrev=0) | |
echo "CY_VERSION=${TAG:1}" >> $GITHUB_ENV | |
- name: Install latest mdbook | |
run: | | |
tag="v0.4.35" | |
url="https://github.com/rust-lang/mdbook/releases/download/${tag}/mdbook-${tag}-x86_64-unknown-linux-gnu.tar.gz" | |
mkdir mdbook | |
curl -sSL $url | tar -xz --directory=./mdbook | |
echo `pwd`/mdbook >> $GITHUB_PATH | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: "1.23" | |
- uses: charmbracelet/vhs-action@v2 | |
- name: Install vim and htop | |
# For the "cy/project" story and "layout/dynamic/color-map" story | |
run: sudo apt-get update && sudo apt-get install -qqy vim htop | |
- name: Build | |
run: > | |
go build | |
-ldflags "-X github.com/cfoust/cy/pkg/version.Version=${CY_VERSION}" | |
-o docs/storybook | |
./cmd/stories/... | |
- name: Install the latest VHS | |
run: | | |
git clone https://github.com/charmbracelet/vhs.git | |
cd vhs | |
go build -o ../vhs-bin . | |
cd .. | |
rm -r vhs | |
mv vhs-bin docs/vhs | |
- name: Build book | |
run: | | |
cd docs | |
mdbook build | |
- name: Setup pages | |
uses: actions/configure-pages@v2 | |
- name: Upload site | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
# Upload entire repository | |
path: "docs/book" | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v1 |