Building and Deploying a Serverless Devs Website with Docusaurus and GitHub Actions
This guide walks through using Serverless Devs to initialize a Docusaurus site, configure deployment settings, and automate publishing via GitHub Actions, providing step‑by‑step commands, YAML configuration, and practical tips for a fully serverless website.
Overview
Serverless Devs is an open‑source platform from Alibaba Cloud that provides a CLI, component model and lifecycle automation for building and deploying serverless applications across multiple clouds.
Choosing Docusaurus
Docusaurus was selected as the static‑site framework for the Serverless Devs documentation because it offers a low‑complexity, maintainable solution for open‑source project sites.
Project Initialization
Use the Serverless Devs CLI to scaffold a Docusaurus website: s init devsapp/website-docusaurus The CLI interactively asks for a project name, OSS bucket name and Alibaba Cloud credentials, then creates the project directory.
Local Development and Build
After initialization you can run the Docusaurus development server locally (e.g., npm start) and build the static assets with npm run build. The generated files are placed in the build directory.
Deployment Configuration (s.yaml)
edition: 1.0.0
access: website_access
services:
website:
component: devsapp/website
actions:
pre-deploy:
- run: npm install
path: ./
- run: npm run build
path: ./
props:
bucket: serverless-devs-website
src:
codeUri: ./
publishDir: ./build
index: index.html
subDir:
type: index
region: cn-hongkongThis file tells the devsapp/website component to install dependencies, build the site, and upload the build output to the specified OSS bucket in the Hong Kong region.
One‑Click Deployment
Deploy the site with a single command: s deploy The CLI reads s.yaml, executes the pre‑deploy actions and publishes the site.
Continuous Deployment with GitHub Actions
Repository: https://github.com/Serverless-Devs/website Add a workflow file (e.g., .github/workflows/publish.yml) to automate deployment on every push to the master branch:
name: Website Publish
on:
push:
branches: [ master ]
jobs:
publish-website:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 12
registry-url: https://registry.npmjs.org/
- run: npm install
- run: npm install -g @serverless-devs/s
- run: s config add --AccountID ${{secrets.ALIYUN_ACCOUNT_ID}} --AccessKeyID ${{secrets.ALIYUN_ACCESS_KEY_ID}} --AccessKeySecret ${{secrets.ALIYUN_ACCESS_KEY_SECRET}} -a website_access
- run: s deployThe workflow installs Node.js, the Serverless Devs CLI, configures Alibaba Cloud credentials from GitHub Secrets, and runs s deploy to publish the site automatically.
Key Points
The CLI guides project scaffolding, dependency installation and build steps.
The s.yaml file centralizes all deployment parameters (bucket, region, build actions).
GitHub Actions provide a minimal continuous‑deployment pipeline with only a few YAML lines.
Remaining Considerations
Broader scenario support for Serverless Devs components is still evolving.
The current pipeline implements CD only; adding a full CI stage (e.g., linting, testing) would improve reliability.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Alibaba Cloud Native
We publish cloud-native tech news, curate in-depth content, host regular events and live streams, and share Alibaba product and user case studies. Join us to explore and share the cloud-native insights you need.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
