Skip to content

Commit

Permalink
ci: add netlify deploy workflow (#3)
Browse files Browse the repository at this point in the history
* chore: deploy without comminting docs directory

* fix: download-docs script

* chore: remove debug

* chore(ci): github action netlify

* chore(ci): netlify cli deploy

* chore: netlify update workflow

* chore(ci): build website

* fix: add working-dir

* chore: update for gnolang/docs.gno.land repo

* chore: change branch deploy
  • Loading branch information
albttx authored Mar 15, 2024
1 parent 732bc2e commit 3092044
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 20 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/netlify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Deploy docs to netlify

on:
workflow_dispatch: {}
push:
branches:
- main

jobs:
deploy-netlify:
name: deploy-to-netlify
runs-on: ubuntu-latest
permissions:
contents: read
deployments: read
steps:
- uses: actions/checkout@v4

- name: Set Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18.x

- name: Build docs.gno.land
working-directory: ./docusaurus
run: |
yarn run download-docs
yarn install
yarn build
- name: Deploy to netlify
uses: netlify/actions/cli@master
with:
args: deploy --site gno-docs --prod
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
.idea
.netlify
2 changes: 1 addition & 1 deletion docusaurus/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const config = {
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: {
path: "../../docs",
path: "../docs",
routeBasePath: "/",
sidebarPath: require.resolve("./sidebars.js"),
showLastUpdateTime: true,
Expand Down
3 changes: 2 additions & 1 deletion docusaurus/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"scripts": {
"docusaurus": "docusaurus",
"start": "docusaurus start",
"download-docs": "bash ../scripts/download-docs.sh",
"build": "docusaurus build",
"swizzle": "docusaurus swizzle",
"deploy": "docusaurus deploy",
Expand All @@ -13,7 +14,7 @@
"write-translations": "docusaurus write-translations",
"write-heading-ids": "docusaurus write-heading-ids",
"typecheck": "tsc",
"embed": "for f in $(find ../../docs -name '*.md'); do embedmd -w $f; done\n"
"embed": "for f in $(find ../docs -name '*.md'); do embedmd -w $f; done\n"
},
"dependencies": {
"@docusaurus/core": "2.4.1",
Expand Down
18 changes: 1 addition & 17 deletions netlify.toml
Original file line number Diff line number Diff line change
@@ -1,27 +1,11 @@

# Settings in the [build] context are global and are applied to
# all contexts unless otherwise overridden by more specific contexts.
[build]
# Directory where the build system installs dependencies
# and runs your build. Store your package.json, .nvmrc, etc here.
# If not set, defaults to the root directory.
base = "docusaurus"

# Directory that contains the deploy-ready HTML files and
# assets generated by the build. This is an absolute path relative
# to the base directory, which is the root by default (/).
# This sample publishes the directory located at the absolute
# path "root/project/build-output"

publish = "build"

# Default build command.
command = "yarn build && yarn install"

ignore = "git diff --quiet $COMMIT_REF $CACHED_COMMIT_REF -- . ../../docs ../../netlify.toml"
command = "yarn run download-docs && yarn build && yarn install"

[[plugins]]
# Installs the Lighthouse Build Plugin for all deploy contexts
package = "@netlify/plugin-lighthouse"

# [[headers]]
Expand Down
8 changes: 8 additions & 0 deletions scripts/download-docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

ROOT_DIR="$(dirname "$0")/.."

wget -O /tmp/gno.zip "https://github.com/gnolang/gno/archive/refs/heads/master.zip"
unzip -d /tmp/ /tmp/gno.zip

cp -r /tmp/gno-master/docs ${ROOT_DIR}/docs

0 comments on commit 3092044

Please sign in to comment.