Skip to content

Merge pull request #168 from DefangLabs/linda-one-click-step-fix #730

Merge pull request #168 from DefangLabs/linda-one-click-step-fix

Merge pull request #168 from DefangLabs/linda-one-click-step-fix #730

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:
environment: github-pages
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: Pre-build
run: npm run prebuild
- 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
# Notify docs chatbot of new docs with curl command
- name: Notify docs chatbot of new docs
run: |
curl -f -X POST https://ask.defang.io/trigger-rebuild?token=${{ secrets.CHATBOT_TOKEN }}
- name: Notify Slack of Action Failures
uses: ravsamhq/[email protected]
if: ${{ always() && github.ref_name == 'main' }}
with:
status: ${{ job.status }}
notify_when: "failure"
notification_title: "{workflow} is failing"
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_NOTIFIER_WEBHOOK_URL }}