mirror of
https://github.com/esphome/esphome.git
synced 2025-07-28 14:16:40 +00:00
Deploy doxygen docs to netlify (#8837)
This commit is contained in:
parent
ef053d23b4
commit
89d283eee4
50
.github/workflows/release.yml
vendored
50
.github/workflows/release.yml
vendored
@ -18,6 +18,7 @@ jobs:
|
|||||||
outputs:
|
outputs:
|
||||||
tag: ${{ steps.tag.outputs.tag }}
|
tag: ${{ steps.tag.outputs.tag }}
|
||||||
branch_build: ${{ steps.tag.outputs.branch_build }}
|
branch_build: ${{ steps.tag.outputs.branch_build }}
|
||||||
|
deploy_env: ${{ steps.tag.outputs.environment }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4.1.7
|
- uses: actions/checkout@v4.1.7
|
||||||
- name: Get tag
|
- name: Get tag
|
||||||
@ -27,6 +28,11 @@ jobs:
|
|||||||
if [[ "${{ github.event_name }}" = "release" ]]; then
|
if [[ "${{ github.event_name }}" = "release" ]]; then
|
||||||
TAG="${{ github.event.release.tag_name}}"
|
TAG="${{ github.event.release.tag_name}}"
|
||||||
BRANCH_BUILD="false"
|
BRANCH_BUILD="false"
|
||||||
|
if [[ "${{ github.event.release.prerelease }}" = "true" ]]; then
|
||||||
|
ENVIRONMENT="beta"
|
||||||
|
else
|
||||||
|
ENVIRONMENT="production"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
TAG=$(cat esphome/const.py | sed -n -E "s/^__version__\s+=\s+\"(.+)\"$/\1/p")
|
TAG=$(cat esphome/const.py | sed -n -E "s/^__version__\s+=\s+\"(.+)\"$/\1/p")
|
||||||
today="$(date --utc '+%Y%m%d')"
|
today="$(date --utc '+%Y%m%d')"
|
||||||
@ -35,12 +41,15 @@ jobs:
|
|||||||
if [[ "$BRANCH" != "dev" ]]; then
|
if [[ "$BRANCH" != "dev" ]]; then
|
||||||
TAG="${TAG}-${BRANCH}"
|
TAG="${TAG}-${BRANCH}"
|
||||||
BRANCH_BUILD="true"
|
BRANCH_BUILD="true"
|
||||||
|
ENVIRONMENT=""
|
||||||
else
|
else
|
||||||
BRANCH_BUILD="false"
|
BRANCH_BUILD="false"
|
||||||
|
ENVIRONMENT="dev"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
echo "tag=${TAG}" >> $GITHUB_OUTPUT
|
echo "tag=${TAG}" >> $GITHUB_OUTPUT
|
||||||
echo "branch_build=${BRANCH_BUILD}" >> $GITHUB_OUTPUT
|
echo "branch_build=${BRANCH_BUILD}" >> $GITHUB_OUTPUT
|
||||||
|
echo "deploy_env=${ENVIRONMENT}" >> $GITHUB_OUTPUT
|
||||||
# yamllint enable rule:line-length
|
# yamllint enable rule:line-length
|
||||||
|
|
||||||
deploy-pypi:
|
deploy-pypi:
|
||||||
@ -251,3 +260,44 @@ jobs:
|
|||||||
version: "${{ needs.init.outputs.tag }}",
|
version: "${{ needs.init.outputs.tag }}",
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
deploy-api-docs:
|
||||||
|
if: github.repository == 'esphome/esphome' && needs.init.outputs.branch_build == 'false'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [init]
|
||||||
|
environment: ${{ needs.init.outputs.deploy_env }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout repo
|
||||||
|
uses: actions/checkout@v4.1.7
|
||||||
|
|
||||||
|
- name: Set up Node.js
|
||||||
|
uses: actions/setup-node@v4.4.0
|
||||||
|
with:
|
||||||
|
node-version: "22"
|
||||||
|
|
||||||
|
- name: Generate docs
|
||||||
|
uses: mattnotmitt/doxygen-action@v1.12.0
|
||||||
|
|
||||||
|
- name: Deploy to netlify ${{ needs.init.outputs.deploy_env }}
|
||||||
|
if: needs.init.outputs.deploy_env != 'production'
|
||||||
|
env:
|
||||||
|
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
||||||
|
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
|
||||||
|
run: |
|
||||||
|
npx netlify-cli deploy \
|
||||||
|
--dir api-docs \
|
||||||
|
--no-build \
|
||||||
|
--alias ${{ needs.init.outputs.deploy_env }} \
|
||||||
|
--message "Deploy API docs for ${{ needs.init.outputs.tag }}"
|
||||||
|
|
||||||
|
- name: Deploy to netlify production
|
||||||
|
if: needs.init.outputs.deploy_env == 'production'
|
||||||
|
env:
|
||||||
|
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
||||||
|
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
|
||||||
|
run: |
|
||||||
|
npx netlify-cli deploy \
|
||||||
|
--dir api-docs \
|
||||||
|
--no-build \
|
||||||
|
--prod \
|
||||||
|
--message "Deploy API docs for ${{ needs.init.outputs.tag }}"
|
||||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -143,3 +143,4 @@ sdkconfig.*
|
|||||||
/components
|
/components
|
||||||
/managed_components
|
/managed_components
|
||||||
|
|
||||||
|
api-docs/
|
||||||
|
@ -54,6 +54,12 @@ def write_version(version: Version):
|
|||||||
r"^__version__ = .*$",
|
r"^__version__ = .*$",
|
||||||
f'__version__ = "{version}"',
|
f'__version__ = "{version}"',
|
||||||
)
|
)
|
||||||
|
# PROJECT_NUMBER = 2025.5.0
|
||||||
|
sub(
|
||||||
|
"Doxyfile",
|
||||||
|
r"PROJECT_NUMBER = .*",
|
||||||
|
f"PROJECT_NUMBER = {version}",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user