Deploy new version to PyPi #39
This file contains 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: Deploy new version to PyPi | |
on: | |
workflow_run: | |
workflows: [Anaconda-Windows] | |
types: | |
- completed | |
jobs: | |
waitForWorklows: | |
name: Wait for workflows | |
runs-on: ubuntu-latest | |
if: github.event.workflow_run.head_branch == 'main' && github.repository == 'pyccel/pyccel' | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.9 | |
- name: Install python dependencies | |
run: | | |
python -m pip install requests jwt | |
- name: Wait for workflows | |
run: | | |
python3 wait_for_main_workflows.py | |
working-directory: ./ci_tools | |
shell: bash | |
env: | |
COMMIT: ${{ github.event.workflow_run.head_sha }} | |
deployVersion: | |
runs-on: ubuntu-latest | |
needs: [waitForWorklows] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
ref: main | |
- name: Install dependencies | |
uses: ./.github/actions/linux_install | |
- name: Update build | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install --upgrade build | |
python -m pip install --upgrade twine | |
- name: Build and deploy | |
run: | | |
echo ${{ github.event.workflow_run.head_branch }} | |
python3 -m build | |
ls dist/* | |
python3 -m twine upload --repository pypi dist/* --non-interactive | |
shell: bash | |
env: | |
TWINE_USERNAME: '__token__' | |
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | |
- name: Install Pyccel without tests | |
run: | | |
python -m pip install . | |
- name: "Get tag name" | |
id: tag_name | |
run: | | |
version=$(python -c "from pyccel import __version__; print(__version__)") | |
echo "TAG_NAME=v${version}" >> $GITHUB_OUTPUT | |
- name: "Update repo tags" | |
uses: EndBug/latest-tag@latest | |
with: | |
ref: ${{ steps.tag_name.outputs.TAG_NAME }} | |