|
| 1 | +name: Private Repo Testing |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + |
| 8 | +concurrency: |
| 9 | + group: 'private-test-${{ github.event.pull_request.number }}' |
| 10 | + cancel-in-progress: true |
| 11 | + |
| 12 | +permissions: |
| 13 | + contents: read |
| 14 | + |
| 15 | +jobs: |
| 16 | + trigger-private-test: |
| 17 | + runs-on: ubuntu-latest |
| 18 | + steps: |
| 19 | + - name: Checkout code |
| 20 | + uses: actions/checkout@v4 |
| 21 | + with: |
| 22 | + fetch-depth: 0 |
| 23 | + - name: Set up Python |
| 24 | + uses: actions/setup-python@v5 |
| 25 | + with: |
| 26 | + python-version: '3.12' |
| 27 | + - name: Install uv |
| 28 | + uses: astral-sh/setup-uv@v6 |
| 29 | + - name: Set up Node.js for UI build |
| 30 | + uses: actions/setup-node@v4 |
| 31 | + with: |
| 32 | + node-version: '20' |
| 33 | + - name: Install pnpm |
| 34 | + uses: pnpm/action-setup@v4 |
| 35 | + with: |
| 36 | + version: latest |
| 37 | + - name: Install UI dependencies |
| 38 | + run: pnpm install |
| 39 | + - name: Build UI |
| 40 | + run: pnpm --prefix web/client run build |
| 41 | + - name: Install Python dependencies |
| 42 | + run: | |
| 43 | + python -m venv .venv |
| 44 | + source .venv/bin/activate |
| 45 | + pip install build twine setuptools_scm |
| 46 | + - name: Generate development version |
| 47 | + id: version |
| 48 | + run: | |
| 49 | + source .venv/bin/activate |
| 50 | + # Generate a PEP 440 compliant unique version including run attempt |
| 51 | + BASE_VERSION=$(python .github/scripts/get_scm_version.py) |
| 52 | + COMMIT_SHA=$(git rev-parse --short HEAD) |
| 53 | + # Use PEP 440 compliant format: base.devN+pr.sha.attempt |
| 54 | + UNIQUE_VERSION="${BASE_VERSION}+pr${{ github.event.pull_request.number }}.${COMMIT_SHA}.run${{ github.run_attempt }}" |
| 55 | + echo "version=$UNIQUE_VERSION" >> $GITHUB_OUTPUT |
| 56 | + echo "Generated unique version with run attempt: $UNIQUE_VERSION" |
| 57 | + - name: Build package |
| 58 | + env: |
| 59 | + SETUPTOOLS_SCM_PRETEND_VERSION: ${{ steps.version.outputs.version }} |
| 60 | + run: | |
| 61 | + source .venv/bin/activate |
| 62 | + python -m build |
| 63 | + - name: Configure PyPI for private repository |
| 64 | + env: |
| 65 | + TOBIKO_PRIVATE_PYPI_URL: ${{ secrets.TOBIKO_PRIVATE_PYPI_URL }} |
| 66 | + TOBIKO_PRIVATE_PYPI_KEY: ${{ secrets.TOBIKO_PRIVATE_PYPI_KEY }} |
| 67 | + run: ./.circleci/update-pypirc.sh |
| 68 | + - name: Publish to private PyPI |
| 69 | + run: | |
| 70 | + source .venv/bin/activate |
| 71 | + python -m twine upload -r tobiko-private dist/* |
| 72 | + - name: Publish Python Tests package |
| 73 | + env: |
| 74 | + SETUPTOOLS_SCM_PRETEND_VERSION: ${{ steps.version.outputs.version }} |
| 75 | + run: | |
| 76 | + source .venv/bin/activate |
| 77 | + unset TWINE_USERNAME TWINE_PASSWORD && make publish-tests |
| 78 | + - name: Get GitHub App token |
| 79 | + id: get_token |
| 80 | + uses: actions/create-github-app-token@v1 |
| 81 | + with: |
| 82 | + private-key: ${{ secrets.TOBIKO_RENOVATE_BOT_PRIVATE_KEY }} |
| 83 | + app-id: ${{ secrets.TOBIKO_RENOVATE_BOT_APP_ID }} |
| 84 | + owner: ${{ secrets.PRIVATE_REPO_OWNER }} |
| 85 | + - name: Trigger private repository workflow |
| 86 | + uses: convictional/[email protected] |
| 87 | + with: |
| 88 | + owner: ${{ secrets.PRIVATE_REPO_OWNER }} |
| 89 | + repo: ${{ secrets.PRIVATE_REPO_NAME }} |
| 90 | + github_token: ${{ steps.get_token.outputs.token }} |
| 91 | + workflow_file_name: ${{ secrets.PRIVATE_WORKFLOW_FILE }} |
| 92 | + client_payload: | |
| 93 | + { |
| 94 | + "package_version": "${{ steps.version.outputs.version }}", |
| 95 | + "pr_number": "${{ github.event.pull_request.number }}" |
| 96 | + } |
0 commit comments