Skip to content

sample-update

sample-update #479

Workflow file for this run

name: Deploy to GitHub Pages
on:
repository_dispatch:
types: [cli-autodoc, sample-update]
push:
branches:
- main
# Review gh actions docs if you want to further define triggers, paths, etc
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on
jobs:
deploy:
permissions:
# This is required to allow the GH actions bot to commit to the `gh-pages` branch
contents: write
name: Deploy to GitHub Pages
runs-on: ubuntu-latest
steps:
- name: Only deploy on repository_dispatch if version starts with 'v'
run: |
echo "Event name: ${{ github.event_name }}"
echo "Type: ${{ github.event.action }}"
echo "Version: ${{ github.event.client_payload.version }}"
if [[ "${{ github.event_name }}" == "repository_dispatch" && "${{ github.event.action }}" == "cli-autodoc" ]]; then
echo "Version: ${{ github.event.client_payload.version }}"
if [[ "${{ github.event.client_payload.version }}" != v* ]]; then
echo "Version does not start with 'v'. Stopping workflow."
exit 1
fi
fi
shell: bash
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
cache: npm
- name: Install dependencies
run: npm ci
- name: Checkout DefangLabs/defang
uses: actions/checkout@v3
with:
repository: DefangLabs/defang
path: defang
ref: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.version || 'main' }}
- name: Checkout DefangLabs/samples
uses: actions/checkout@v3
with:
repository: DefangLabs/samples
path: samples
ref: main
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: "1.21"
- name: Generate CLI docs
run: go run main.go ./tmp
working-directory: defang/src/cmd/gendocs
- name: Copy CLI docs to current repository
run: cp -r ./defang/src/cmd/gendocs/tmp/* ./docs/cli
- name: Prep CLI docs
run: npm run prep-cli-docs
- name: Prep Samples
run: npm run prep-samples
- name: Build website
run: npm run build
# Popular action to deploy to GitHub Pages:
# Docs: https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-docusaurus
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
# Build output to publish to the `gh-pages` branch:
publish_dir: ./build
# The following lines assign commit authorship to the official
# GH-Actions bot for deploys to `gh-pages` branch:
# https://github.com/actions/checkout/issues/13#issuecomment-724415212
# The GH actions bot is used by default if you didn't specify the two fields.
# You can swap them out with your own user credentials.
user_name: github-actions[bot]
user_email: 41898282+github-actions[bot]@users.noreply.github.com
cname: docs.defang.io