@@ -3,11 +3,11 @@ name: Update SDK Status
33on :
44 workflow_run :
55 workflows : ["Release"]
6- types :
7- - completed
6+ types : [completed]
7+ branches : [main]
8+ workflow_dispatch :
89 schedule :
910 - cron : ' 0 7 * * *' # Daily at 7 AM UTC (after validation)
10- workflow_dispatch :
1111
1212permissions :
1313 contents : write
@@ -16,98 +16,99 @@ jobs:
1616 update-status :
1717 name : Update SDK Status
1818 runs-on : ubuntu-latest
19+ if : ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
1920 steps :
2021 - uses : actions/checkout@v4
2122 with :
22- token : ${{ secrets.GITHUB_TOKEN }}
23+ fetch-depth : 0
2324
2425 - name : Set up Python
2526 uses : actions/setup-python@v5
2627 with :
2728 python-version : ' 3.11'
2829
29- - name : Get latest version from PyPI
30- id : pypi_version
31- run : |
32- VERSION=$(pip index versions iptuapi 2>/dev/null | grep -oP 'iptuapi \(\K[^)]+' | head -1 || echo "not published")
33- if [ -z "$VERSION" ]; then
34- VERSION=$(curl -s https://pypi.org/pypi/iptuapi/json | python -c "import sys, json; print(json.load(sys.stdin).get('info', {}).get('version', 'not published'))" 2>/dev/null || echo "not published")
35- fi
36- echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
37- echo "Latest PyPI version: $VERSION"
38-
39- - name : Get pyproject.toml version
40- id : pkg_version
30+ - name : Get latest version
31+ id : version
4132 run : |
42- VERSION=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])" 2>/dev/null || echo "unknown")
43- echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
44- echo "pyproject.toml version: $VERSION"
33+ VERSION=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])" 2>/dev/null || grep -m1 'version' setup.py | cut -d'"' -f2 || echo "unknown")
34+ echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
4535
46- - name : Run validation check
36+ - name : Get validation status
4737 id : validation
48- continue-on-error : true
4938 run : |
50- python -m venv /tmp/status-check
51- source /tmp/status-check/bin/activate
52- pip install iptuapi 2>/dev/null
53-
54- # Test import
55- if python -c "from iptuapi import IPTUClient; print('OK')" 2>/dev/null; then
56- echo "STATUS=passing" >> $GITHUB_OUTPUT
39+ VALIDATION_STATUS=$(gh run list --workflow=sdk-validation.yml --limit 1 --json conclusion --jq '.[0].conclusion // "unknown"')
40+ if [ "$VALIDATION_STATUS" = "success" ]; then
41+ echo "STATUS=FUNCIONAL" >> $GITHUB_OUTPUT
42+ echo "EMOJI=🟢" >> $GITHUB_OUTPUT
5743 else
58- echo "STATUS=failing" >> $GITHUB_OUTPUT
44+ echo "STATUS=VERIFICAR" >> $GITHUB_OUTPUT
45+ echo "EMOJI=🟡" >> $GITHUB_OUTPUT
5946 fi
60-
61- - name : Get current date
62- id : date
63- run : echo "DATE=$(date -u +'%Y-%m-%d %H:%M UTC')" >> $GITHUB_OUTPUT
47+ env :
48+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
6449
6550 - name : Update SDK-STATUS.md
6651 run : |
67- cat > SDK-STATUS.md << 'EOF'
68- # SDK Status
52+ DATE=$(date -u +%Y-%m-%d)
53+ VERSION="${{ steps.version.outputs.VERSION }}"
54+ STATUS="${{ steps.validation.outputs.STATUS }}"
55+ EMOJI="${{ steps.validation.outputs.EMOJI }}"
56+
57+ cat > SDK-STATUS.md << EOF
58+ # Python SDK Status
59+
60+ **Última atualização:** ${DATE}
61+ **Versão:** ${VERSION}
62+ **Status:** ${EMOJI} ${STATUS}
63+
64+ ---
6965
70- > Auto-generated status file. Last updated: ${{ steps.date.outputs.DATE }}
66+ ## Informações
7167
72- ## Version Information
68+ | Item | Valor |
69+ |------|-------|
70+ | **Versão** | ${VERSION} |
71+ | **Registry** | PyPI (\`pip install iptuapi\`) |
72+ | **Status** | ${EMOJI} ${STATUS} |
73+ | **Mínimo** | Python 3.8+ |
7374
74- | Metric | Value |
75- |--------|-------|
76- | **Latest Published** | ${{ steps.pypi_version.outputs.VERSION }} |
77- | **Source Version** | ${{ steps.pkg_version.outputs.VERSION }} |
78- | **Registry** | PyPI (pypi.org) |
79- | **Package** | iptuapi |
75+ ## Instalação
8076
81- ## Validation Status
77+ \`\`\`bash
78+ pip install iptuapi
79+ \`\`\`
8280
83- | Check | Status |
84- |-------|--------|
85- | **Clean Install** | ${{ steps.validation.outputs.STATUS == 'passing' && '✅ Passing' || '❌ Failing' }} |
86- | **Python Import** | ${{ steps.validation.outputs.STATUS == 'passing' && '✅ Passing' || '❌ Failing' }} |
81+ ## Exemplo Rápido
8782
88- ## Compatibility
83+ \`\`\`python
84+ from iptuapi import IPTUClient
8985
90- | Python Version | Status |
91- |----------------|--------|
92- | 3.9 | ✅ Supported |
93- | 3.10 | ✅ Supported |
94- | 3.11 | ✅ Supported |
95- | 3.12 | ✅ Supported |
86+ client = IPTUClient("sua_api_key")
87+ cidades = client.iptu_tools_cidades()
88+ print(f"{cidades['total']} cidades disponíveis")
89+ \`\`\`
9690
97- ## Links
91+ ## Validação Automática
9892
99- - [PyPI Package](https://pypi.org/project/iptuapi/)
100- - [API Documentation](https://docs.iptuapi.com.br)
101- - [GitHub Repository](https://github.com/raphaeltorquat0/iptuapi-python)
93+ Este SDK é validado automaticamente:
94+ - ✅ Instalação limpa via pip
95+ - ✅ Import do pacote
96+ - ✅ Teste contra API real (\`iptu_tools_cidades\`)
97+ - ✅ Teste autenticado (\`consulta_endereco\`)
10298
10399 ---
104- *This file is automatically updated by GitHub Actions.*
100+
101+ *Atualizado automaticamente pelo CI/CD*
105102 EOF
106103
107- - name : Commit status update
104+ - name : Commit and push
108105 run : |
109- git config --local user.email "github-actions[bot]@users.noreply.github.com "
110- git config --local user.name "github-actions[bot]"
106+ git config user.name "github-actions[bot]"
107+ git config user.email "github-actions[bot]@users.noreply.github.com "
111108 git add SDK-STATUS.md
112- git diff --staged --quiet || git commit -m "chore: update SDK status [skip ci]"
113- git push || echo "No changes to push"
109+ if git diff --staged --quiet; then
110+ echo "No changes to commit"
111+ else
112+ git commit -m "chore: update SDK status [skip ci]"
113+ git push
114+ fi
0 commit comments