validate-package #1
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: Validate Package Workflow | |
| on: | |
| repository_dispatch: | |
| types: [validate-package] | |
| jobs: | |
| process-message: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Generate GitHub App token | |
| id: generate-token | |
| uses: tibdex/github-app-token@v2 | |
| with: | |
| app_id: ${{ secrets.HATCH_WORKFLOW_APP_ID }} | |
| private_key: ${{ secrets.HATCH_WORKFLOW_APP_PRIVATE_KEY }} | |
| - name: Download package artifact | |
| uses: dawidd6/action-download-artifact@v9 | |
| with: | |
| github_token: ${{ steps.generate-token.outputs.token }} | |
| workflow: ${{ github.event.client_payload.workflow_id }} | |
| run_id: ${{ github.event.client_payload.run_id }} | |
| name: ${{ github.event.client_payload.artifact_name }} | |
| repo: ${{ github.event.client_payload.repository }} | |
| path: downloaded-package | |
| - name: Print received package content | |
| run: | | |
| echo "Processing package: ${{ github.event.client_payload.package_name }}" | |
| echo "Package contents:" | |
| ls -la downloaded-package | |
| - name: Install pip | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| cache: 'pip' | |
| - name: Install Hatch-Registry | |
| run: | | |
| pip install -r requirements.txt | |
| pip install . | |
| - name: Validate package | |
| run: | | |
| hatch-registry validate-package --repository-name ${{ github.event.client_payload.repository }} --package-dir ./downloaded-package | |
| if [ $? -ne 0 ]; then | |
| echo "Package validation failed." | |
| exit 1 | |
| fi |