mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-31 15:12:06 +00:00 
			
		
		
		
	[api-docs] Run using netlify builders (#8842)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
		
							
								
								
									
										41
									
								
								.github/workflows/release.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										41
									
								
								.github/workflows/release.yml
									
									
									
									
										vendored
									
									
								
							| @@ -259,44 +259,3 @@ jobs: | ||||
|                 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 }}" | ||||
|   | ||||
							
								
								
									
										3
									
								
								.netlify/netlify.toml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								.netlify/netlify.toml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,3 @@ | ||||
| [build] | ||||
|   command = "script/build-api-docs" | ||||
|   publish = "api-docs" | ||||
							
								
								
									
										34
									
								
								script/build-api-docs
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										34
									
								
								script/build-api-docs
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,34 @@ | ||||
| #!/usr/bin/env bash | ||||
| set -euo pipefail | ||||
| DOXYGEN_VERSION="1.12.0" | ||||
| DOXYGEN_TAG="Release_${DOXYGEN_VERSION//./_}" | ||||
|  | ||||
| DOXYGEN_PATH="doxygen" | ||||
|  | ||||
| download_doxygen() { | ||||
|   TEMP_DIR="$(mktemp -d)" | ||||
|   trap 'rm -rf "$TEMP_DIR"' EXIT | ||||
|   pushd "$TEMP_DIR" >/dev/null | ||||
|   echo "downloading doxygen..." | ||||
|   curl -o doxygen.tar.gz -L "https://github.com/doxygen/doxygen/releases/download/${DOXYGEN_TAG}/doxygen-${DOXYGEN_VERSION}.linux.bin.tar.gz" | ||||
|   tar -xzf doxygen.tar.gz | ||||
|   rm doxygen.tar.gz | ||||
|   DOXYGEN_PATH="$TEMP_DIR/doxygen-${DOXYGEN_VERSION}/bin/doxygen" | ||||
|   popd >/dev/null | ||||
|   echo "doxygen downloaded successfully" | ||||
| } | ||||
|  | ||||
| # if doxygen command not found or version not as above, download it | ||||
| if command -v doxygen &>/dev/null; then | ||||
|   DOXYGEN_VERSION_INSTALLED=$(doxygen --version) | ||||
|   if [[ $DOXYGEN_VERSION_INSTALLED != $DOXYGEN_VERSION ]]; then | ||||
|     echo "doxygen version $DOXYGEN_VERSION_INSTALLED found, but not the expected version $DOXYGEN_VERSION" | ||||
|     download_doxygen | ||||
|   else | ||||
|     echo "doxygen version $DOXYGEN_VERSION_INSTALLED found, using it" | ||||
|   fi | ||||
| else | ||||
|   download_doxygen | ||||
| fi | ||||
|  | ||||
| exec $DOXYGEN_PATH | ||||
		Reference in New Issue
	
	Block a user