chore: sync unified package v0.1.1 #3029
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: Publish Connectors | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'connectors/**' | |
| permissions: | |
| contents: write | |
| jobs: | |
| detect-changes: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| connectors: ${{ steps.detect.outputs.connectors }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 2 | |
| - id: detect | |
| run: | | |
| # Detect changed connector directories | |
| changed=$(git diff --name-only HEAD~1 HEAD -- connectors/ | \ | |
| grep -oP 'connectors/\K[^/]+' | sort -u | jq -R -s -c 'split("\n") | map(select(length > 0))') | |
| echo "connectors=$changed" >> $GITHUB_OUTPUT | |
| publish: | |
| needs: detect-changes | |
| if: needs.detect-changes.outputs.connectors != '[]' | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| connector: ${{ fromJson(needs.detect-changes.outputs.connectors) }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.13' | |
| - name: Install build tools | |
| run: pip install build twine pytest pytest-asyncio httpx pydantic pyyaml python-dotenv | |
| - name: Install connector dependencies | |
| run: pip install connectors/${{ matrix.connector }}/ | |
| - name: Get release info | |
| id: release_info | |
| run: | | |
| python scripts/release_info.py \ | |
| --pyproject connectors/${{ matrix.connector }}/pyproject.toml \ | |
| --changelog connectors/${{ matrix.connector }}/CHANGELOG.md \ | |
| --package-name airbyte-agent-${{ matrix.connector }} \ | |
| --github-output >> $GITHUB_OUTPUT | |
| - name: Build package | |
| if: steps.release_info.outputs.should_publish == 'true' | |
| run: python -m build connectors/${{ matrix.connector }}/ | |
| - name: Publish to PyPI | |
| if: steps.release_info.outputs.should_publish == 'true' | |
| env: | |
| TWINE_USERNAME: __token__ | |
| TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} | |
| run: | | |
| max_attempts=5 | |
| attempt=1 | |
| base_delay=10 | |
| while [ $attempt -le $max_attempts ]; do | |
| echo "Attempt $attempt of $max_attempts..." | |
| if twine upload connectors/${{ matrix.connector }}/dist/*; then | |
| echo "Upload successful!" | |
| exit 0 | |
| fi | |
| if [ $attempt -eq $max_attempts ]; then | |
| echo "All $max_attempts attempts failed." | |
| exit 1 | |
| fi | |
| # Exponential backoff: 10s, 20s, 40s, 80s | |
| delay=$((base_delay * (2 ** (attempt - 1)))) | |
| echo "Upload failed. Retrying in ${delay}s..." | |
| sleep $delay | |
| attempt=$((attempt + 1)) | |
| done | |
| - name: Create GitHub Release | |
| if: steps.release_info.outputs.should_publish == 'true' | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: airbyte-agent-${{ matrix.connector }}-v${{ steps.release_info.outputs.version }} | |
| name: airbyte-agent-${{ matrix.connector }} ${{ steps.release_info.outputs.version }} | |
| body: ${{ steps.release_info.outputs.notes }} | |
| generate_release_notes: false | |
| notify-on-failure: | |
| name: Notify on Failure | |
| needs: [detect-changes, publish] | |
| if: always() && needs.publish.result == 'failure' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Send Slack notification | |
| uses: ./.github/actions/notification-to-slack | |
| with: | |
| slackbot_token: ${{ secrets.SLACK_AIRBYTE_TOOLING_BOT_API_TOKEN }} | |
| channel: C07PPP45S78 # #ask-devin-ai | |
| message_text: ":x: Connector publish workflow failed!" | |
| message_body: | | |
| [ | |
| { | |
| "type": "section", | |
| "text": { | |
| "type": "mrkdwn", | |
| "text": ":x: *Connector publish workflow failed!*\n\n<https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|View workflow run>" | |
| } | |
| } | |
| ] |