|
| 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 | +jobs: |
| 13 | + trigger-private-test: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + if: github.event.pull_request.head.repo.full_name == github.repository |
| 16 | + |
| 17 | + steps: |
| 18 | + - name: Checkout code |
| 19 | + uses: actions/checkout@v4 |
| 20 | + with: |
| 21 | + fetch-depth: 0 |
| 22 | + - name: Set up Python |
| 23 | + uses: actions/setup-python@v5 |
| 24 | + with: |
| 25 | + python-version: '3.12' |
| 26 | + - name: Install uv |
| 27 | + uses: astral-sh/setup-uv@v6 |
| 28 | + - name: Set up Node.js for UI build |
| 29 | + uses: actions/setup-node@v4 |
| 30 | + with: |
| 31 | + node-version: '20' |
| 32 | + - name: Install pnpm |
| 33 | + uses: pnpm/action-setup@v4 |
| 34 | + with: |
| 35 | + version: latest |
| 36 | + - name: Install UI dependencies |
| 37 | + run: pnpm install |
| 38 | + - name: Build UI |
| 39 | + run: pnpm --prefix web/client run build |
| 40 | + - name: Install Python dependencies |
| 41 | + run: | |
| 42 | + python -m venv .venv |
| 43 | + source .venv/bin/activate |
| 44 | + pip install build twine setuptools_scm |
| 45 | + - name: Generate development version |
| 46 | + id: version |
| 47 | + run: | |
| 48 | + source .venv/bin/activate |
| 49 | + # Generate a development version using existing script |
| 50 | + DEV_VERSION=$(python .github/scripts/get_scm_version.py) |
| 51 | + echo "version=$DEV_VERSION" >> $GITHUB_OUTPUT |
| 52 | + echo "Generated development version: $DEV_VERSION" |
| 53 | + - name: Build package |
| 54 | + run: | |
| 55 | + source .venv/bin/activate |
| 56 | + python -m build |
| 57 | + - name: Configure PyPI for private repository |
| 58 | + run: | |
| 59 | + cat > ~/.pypirc << EOF |
| 60 | + [distutils] |
| 61 | + index-servers = tobiko-private |
| 62 | + [tobiko-private] |
| 63 | + repository = ${{ secrets.TOBIKO_PRIVATE_PYPI_URL }} |
| 64 | + username = _json_key_base64 |
| 65 | + password = ${{ secrets.TOBIKO_PRIVATE_PYPI_KEY }} |
| 66 | + EOF |
| 67 | + - name: Publish to private PyPI |
| 68 | + run: | |
| 69 | + source .venv/bin/activate |
| 70 | + python -m twine upload -r tobiko-private dist/* |
| 71 | + - name: Get commit information |
| 72 | + id: commit |
| 73 | + run: | |
| 74 | + echo "author=$(git log -1 --format='%an')" >> $GITHUB_OUTPUT |
| 75 | + echo "hash=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT |
| 76 | + echo "message=$(git log -1 --format='%s')" >> $GITHUB_OUTPUT |
| 77 | + - name: Trigger private repository workflow |
| 78 | + uses: convictional/[email protected] |
| 79 | + with: |
| 80 | + owner: ${{ secrets.PRIVATE_REPO_OWNER }} |
| 81 | + repo: ${{ secrets.PRIVATE_REPO_NAME }} |
| 82 | + github_token: ${{ secrets.PRIVATE_REPO_TOKEN }} |
| 83 | + workflow_file_name: ${{ secrets.PRIVATE_WORKFLOW_FILE }} |
| 84 | + client_payload: | |
| 85 | + { |
| 86 | + "package_version": "${{ steps.version.outputs.version }}", |
| 87 | + "python_version": "3.12", |
| 88 | + "author": "${{ steps.commit.outputs.author }}", |
| 89 | + "hash": "${{ steps.commit.outputs.hash }}", |
| 90 | + "message": "${{ steps.commit.outputs.message }}", |
| 91 | + "pr_number": "${{ github.event.pull_request.number }}" |
| 92 | + } |
0 commit comments