Push component to Espressif Component Service #11
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Push component to Espressif Component Service | |
| on: | |
| push: | |
| tags: | |
| - 'v*' # Trigger when pushing version tags (e.g., v1.0.0) | |
| release: | |
| types: [published] # Trigger when creating Release | |
| jobs: | |
| upload_component: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Verify idf_component.yml | |
| run: | | |
| echo "Checking idf_component.yml file..." | |
| if [ ! -f "idf_component.yml" ]; then | |
| echo "Error: idf_component.yml file not found" | |
| exit 1 | |
| fi | |
| echo "idf_component.yml file exists" | |
| cat idf_component.yml | |
| - name: Create Release if not exists | |
| if: github.event_name == 'push' | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| TAG_NAME="${{ github.ref_name }}" | |
| # Check if Release already exists | |
| if curl -s -H "Authorization: token $GITHUB_TOKEN" \ | |
| "https://api.github.com/repos/maker-community/esp-signalr/releases/tags/$TAG_NAME" | grep -q '"id"'; then | |
| echo "Release $TAG_NAME already exists, skipping creation" | |
| else | |
| echo "Creating Release $TAG_NAME..." | |
| curl -X POST \ | |
| -H "Authorization: token $GITHUB_TOKEN" \ | |
| -H "Accept: application/vnd.github.v3+json" \ | |
| -H "Content-Type: application/json; charset=utf-8" \ | |
| "https://api.github.com/repos/maker-community/esp-signalr/releases" \ | |
| -d "{ | |
| \"tag_name\": \"$TAG_NAME\", | |
| \"name\": \"$TAG_NAME\", | |
| \"body\": \"$TAG_NAME\\n\\nComponent will be automatically synced to ESP Component Registry.\\n\\nView component: https://components.espressif.com/components/verdure/esp-signalr\", | |
| \"draft\": false, | |
| \"prerelease\": false | |
| }" | |
| fi | |
| - name: Upload component to component service | |
| uses: espressif/upload-components-ci-action@v1 | |
| with: | |
| directories: > | |
| . | |
| namespace: "verdure" | |
| name: "esp-signalr" | |
| api_token: ${{ secrets.IDF_COMPONENT_API_TOKEN }} | |
| - name: Summary | |
| run: | | |
| echo "## Component Release Info" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Tag**: ${{ github.ref_name }}" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Repository**: https://github.com/maker-community/esp-signalr" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Component Link**: https://components.espressif.com/components/verdure/esp-signalr" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "Component uploaded to ESP Component Registry." >> $GITHUB_STEP_SUMMARY |