|
| 1 | +name: Deploy new version to PyPi |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_run: |
| 5 | + workflows: [Anaconda-Windows] |
| 6 | + types: |
| 7 | + - completed |
| 8 | + |
| 9 | +jobs: |
| 10 | + waitForWorklows: |
| 11 | + name: Wait for workflows |
| 12 | + runs-on: ubuntu-latest |
| 13 | + if: github.event.workflow_run.head_branch == 'main' |
| 14 | + steps: |
| 15 | + - name: Checkout repository |
| 16 | + uses: actions/checkout@v4 |
| 17 | + - name: Set up Python |
| 18 | + uses: actions/setup-python@v5 |
| 19 | + with: |
| 20 | + python-version: 3.9 |
| 21 | + - name: Install python dependencies |
| 22 | + run: | |
| 23 | + python -m pip install requests jwt |
| 24 | + - name: Wait for workflows |
| 25 | + run: | |
| 26 | + python3 wait_for_main_workflows.py |
| 27 | + working-directory: ./ci_tools |
| 28 | + shell: bash |
| 29 | + env: |
| 30 | + COMMIT: ${{ github.event.workflow_run.head_sha }} |
| 31 | + |
| 32 | + deployVersion: |
| 33 | + runs-on: ubuntu-latest |
| 34 | + needs: [waitForWorklows] |
| 35 | + steps: |
| 36 | + - name: Checkout repository |
| 37 | + uses: actions/checkout@v4 |
| 38 | + with: |
| 39 | + submodules: true |
| 40 | + - name: Install dependencies |
| 41 | + uses: ./.github/actions/linux_install |
| 42 | + - name: Update build |
| 43 | + run: | |
| 44 | + python -m pip install --upgrade pip |
| 45 | + python -m pip install --upgrade build |
| 46 | + python -m pip install --upgrade twine |
| 47 | + - name: Build and deploy |
| 48 | + run: | |
| 49 | + echo ${{ github.event.workflow_run.head_branch }} |
| 50 | + python3 -m build |
| 51 | + ls dist/* |
| 52 | + python3 -m twine upload --repository pypi dist/* --non-interactive |
| 53 | + shell: bash |
| 54 | + env: |
| 55 | + TWINE_USERNAME: '__token__' |
| 56 | + TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} |
| 57 | + - name: Install Pyccel without tests |
| 58 | + run: | |
| 59 | + python -m pip install . |
| 60 | + - name: "Get tag name" |
| 61 | + id: tag_name |
| 62 | + run: | |
| 63 | + version=$(python -c "from pyccel import __version__; print(__version__)") |
| 64 | + echo "TAG_NAME=v${version}" >> $GITHUB_OUTPUT |
| 65 | + - name: "Update repo tags" |
| 66 | + uses: EndBug/latest-tag@latest |
| 67 | + with: |
| 68 | + ref: ${{ steps.tag_name.outputs.TAG_NAME }} |
| 69 | + |
0 commit comments