Skip to content

Commit a644807

Browse files
authored
Create deploy workflow (pyccel#1862)
- Update `actions/checkout` and `actions/setup-python` to remove Node.js version deprecation warnings - Add a `deploy` workflow which uses `ci_tools/wait_for_main_workflows.py` to wait until all the workflows for `main` have completed and succeeded and then updates the repo by: 1. Building the distribution 2. Shipping the distribution to PyPI 3. Adding a tag to the commit with the version - Allow the GitHub API tools to be used for get operations without authenticating as the bot - Correct the files included in the wheel to only include source files (fixes pyccel#1436)
1 parent a485f6e commit a644807

22 files changed

+213
-51
lines changed

.github/workflows/anaconda_linux.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
needs: Python_version_picker
5353

5454
steps:
55-
- uses: actions/checkout@v3
55+
- uses: actions/checkout@v4
5656
with:
5757
ref: ${{ env.COMMIT }}
5858
repository: ${{ env.PR_REPO }}

.github/workflows/anaconda_windows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
needs: Python_version_picker
5353

5454
steps:
55-
- uses: actions/checkout@v3
55+
- uses: actions/checkout@v4
5656
with:
5757
ref: ${{ env.COMMIT }}
5858
repository: ${{ env.PR_REPO }}

.github/workflows/clean_up.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
name: Report result
1111

1212
steps:
13-
- uses: actions/checkout@v3
13+
- uses: actions/checkout@v4
1414
with:
1515
fetch-depth: 0
1616
- name: Clean up

.github/workflows/comment_bot.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ jobs:
99
if: ${{ startsWith( github.event.comment.body, '/bot ' ) }}
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v3
12+
- uses: actions/checkout@v4
1313
with:
1414
fetch-depth: 0
1515
- uses: ./.github/actions/add_remote
1616
with:
1717
pr_id: ${{ github.event.issue.number }}
1818
- name: Set up Python 3.9
19-
uses: actions/setup-python@v4
19+
uses: actions/setup-python@v5
2020
with:
2121
python-version: 3.9
2222
- name: Install python dependencies

.github/workflows/coverage.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ jobs:
4040
name: Unit tests
4141

4242
steps:
43-
- uses: actions/checkout@v3
43+
- uses: actions/checkout@v4
4444
with:
4545
ref: ${{ env.COMMIT }}
4646
repository: ${{ env.PR_REPO }}
4747
submodules: true
4848
- name: Set up Python ${{ inputs.python_version }}
49-
uses: actions/setup-python@v4
49+
uses: actions/setup-python@v5
5050
with:
5151
python-version: ${{ inputs.python_version }}
5252
- name: "Setup"

.github/workflows/deploy.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
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+

.github/workflows/docs.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,20 @@ jobs:
3434
name: Documentation Format
3535

3636
steps:
37-
- uses: actions/checkout@v3
37+
- uses: actions/checkout@v4
3838
with:
3939
ref: ${{ inputs.base }}
4040
path: base
4141
submodules: true
42-
- uses: actions/checkout@v3
42+
- uses: actions/checkout@v4
4343
with:
4444
path: compare
4545
ref: ${{ env.COMMIT }}
4646
repository: ${{ env.PR_REPO }}
4747
fetch-depth: 0
4848
submodules: true
4949
- name: Set up Python ${{ inputs.python_version }}
50-
uses: actions/setup-python@v4
50+
uses: actions/setup-python@v5
5151
with:
5252
python-version: ${{ inputs.python_version }}
5353
- name: "Setup check run"

.github/workflows/intel.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ jobs:
5454
needs: Python_version_picker
5555

5656
steps:
57-
- uses: actions/checkout@v3
57+
- uses: actions/checkout@v4
5858
with:
5959
ref: ${{ env.COMMIT }}
6060
repository: ${{ env.PR_REPO }}
6161
submodules: true
6262
- name: Set up Python ${{ needs.Python_version_picker.outputs.python_version }}
63-
uses: actions/setup-python@v4
63+
uses: actions/setup-python@v5
6464
with:
6565
python-version: ${{ needs.Python_version_picker.outputs.python_version }}
6666
- name: "Setup"

.github/workflows/linux.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ jobs:
5757
matrix: ${{fromJson(needs.matrix_prep.outputs.matrix)}}
5858

5959
steps:
60-
- uses: actions/checkout@v3
60+
- uses: actions/checkout@v4
6161
with:
6262
ref: ${{ env.COMMIT }}
6363
repository: ${{ env.PR_REPO }}
6464
submodules: true
6565
- name: Set up Python ${{ matrix.python_version }}
66-
uses: actions/setup-python@v4
66+
uses: actions/setup-python@v5
6767
with:
6868
python-version: ${{ matrix.python_version }}
6969
- name: "Setup"

.github/workflows/macosx.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@ jobs:
5353
needs: Python_version_picker
5454

5555
steps:
56-
- uses: actions/checkout@v3
56+
- uses: actions/checkout@v4
5757
with:
5858
ref: ${{ env.COMMIT }}
5959
repository: ${{ env.PR_REPO }}
6060
submodules: true
6161
- name: Set up Python ${{ needs.Python_version_picker.outputs.python_version }}
62-
uses: actions/setup-python@v4
62+
uses: actions/setup-python@v5
6363
with:
6464
python-version: ${{ needs.Python_version_picker.outputs.python_version }}
6565
- name: "Setup"

0 commit comments

Comments
 (0)