Skip to content

Commit a1a8fc1

Browse files
committed
Test: Trusted publishing on PyPI with twine
1 parent 0ec79b3 commit a1a8fc1

File tree

2 files changed

+57
-55
lines changed

2 files changed

+57
-55
lines changed

.github/workflows/publish.yml

+56-54
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
1-
name: Upload Release Package to PyPI
1+
name: Release to PyPI
22

33
on:
44
release:
55
types: [released]
6+
pull-request:
67

78
jobs:
89
deploy:
910
runs-on: ubuntu-latest
11+
environment: release
12+
permissions:
13+
# IMPORTANT: this permission is mandatory for trusted publishing
14+
id-token: write
1015
steps:
1116
- name: Check out Pulser
1217
uses: actions/checkout@v3
@@ -24,9 +29,6 @@ jobs:
2429
shell: bash
2530
run: ./.github/scripts/package.sh
2631
- name: Publish to TestPyPI
27-
env:
28-
TWINE_USERNAME: ${{ secrets.TESTPYPI_USERNAME }}
29-
TWINE_PASSWORD: ${{ secrets.TESTPYPI_PASSWORD }}
3032
run: twine upload --repository testpypi dist/*
3133
- name: Install from TestPyPI
3234
timeout-minutes: 5
@@ -43,54 +45,54 @@ jobs:
4345
run: |
4446
grep -e pytest dev_requirements.txt | sed 's/ //g' | xargs pip install
4547
pytest
46-
- name: Publish to PyPI
47-
env:
48-
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
49-
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
50-
run: twine upload dist/*
51-
- name: Confirm deployment
52-
timeout-minutes: 5
53-
shell: bash
54-
run: |
55-
version="$(head -1 VERSION.txt)"
56-
until pip download pulser==$version
57-
do
58-
echo "Failed to download from PyPI, will wait for upload and retry."
59-
sleep 30
60-
done
48+
# - name: Publish to PyPI
49+
# env:
50+
# TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
51+
# TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
52+
# run: twine upload dist/*
53+
# - name: Confirm deployment
54+
# timeout-minutes: 5
55+
# shell: bash
56+
# run: |
57+
# version="$(head -1 VERSION.txt)"
58+
# until pip download pulser==$version
59+
# do
60+
# echo "Failed to download from PyPI, will wait for upload and retry."
61+
# sleep 30
62+
# done
6163

62-
check-release:
63-
needs: deploy
64-
runs-on: ${{ matrix.os }}
65-
strategy:
66-
fail-fast: false
67-
matrix:
68-
os: [ubuntu-latest, macos-latest, windows-latest]
69-
python-version: ["3.8", "3.9", "3.10", "3.11"]
70-
steps:
71-
- name: Check out Pulser
72-
uses: actions/checkout@v3
73-
with:
74-
ref: ${{ github.ref }}
75-
- name: Set up Python
76-
uses: actions/setup-python@v4
77-
with:
78-
python-version: ${{ matrix.python-version }}
79-
- name: Install Pulser from PyPI
80-
timeout-minutes: 5
81-
shell: bash
82-
run: |
83-
python -m pip install --upgrade pip
84-
version="$(head -1 VERSION.txt)"
85-
until pip install pulser==$version
86-
do
87-
echo "Failed to install from PyPI, will wait for upload and retry."
88-
sleep 30
89-
done
90-
- name: Test the installation
91-
shell: bash
92-
run: |
93-
version="$(head -1 VERSION.txt)"
94-
python -c "import pulser; assert pulser.__version__ == '$version'"
95-
grep -e pytest dev_requirements.txt | sed 's/ //g' | xargs pip install
96-
pytest
64+
# check-release:
65+
# needs: deploy
66+
# runs-on: ${{ matrix.os }}
67+
# strategy:
68+
# fail-fast: false
69+
# matrix:
70+
# os: [ubuntu-latest, macos-latest, windows-latest]
71+
# python-version: ["3.8", "3.9", "3.10", "3.11"]
72+
# steps:
73+
# - name: Check out Pulser
74+
# uses: actions/checkout@v3
75+
# with:
76+
# ref: ${{ github.ref }}
77+
# - name: Set up Python
78+
# uses: actions/setup-python@v4
79+
# with:
80+
# python-version: ${{ matrix.python-version }}
81+
# - name: Install Pulser from PyPI
82+
# timeout-minutes: 5
83+
# shell: bash
84+
# run: |
85+
# python -m pip install --upgrade pip
86+
# version="$(head -1 VERSION.txt)"
87+
# until pip install pulser==$version
88+
# do
89+
# echo "Failed to install from PyPI, will wait for upload and retry."
90+
# sleep 30
91+
# done
92+
# - name: Test the installation
93+
# shell: bash
94+
# run: |
95+
# version="$(head -1 VERSION.txt)"
96+
# python -c "import pulser; assert pulser.__version__ == '$version'"
97+
# grep -e pytest dev_requirements.txt | sed 's/ //g' | xargs pip install
98+
# pytest

VERSION.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.16dev2
1+
0.15.2a0

0 commit comments

Comments
 (0)