|
1 |
| -name: Publish Python 🐍 distributions 📦 to PyPI and TestPyPI |
| 1 | +name: release |
2 | 2 |
|
3 |
| -on: push |
| 3 | +on: |
| 4 | + push: |
| 5 | + # Sequence of patterns matched against refs/tags |
| 6 | + tags: |
| 7 | + - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 |
4 | 8 |
|
5 | 9 | jobs:
|
6 |
| - build-n-publish: |
7 |
| - name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI |
| 10 | + build: |
| 11 | + name: Create Release |
8 | 12 | runs-on: ubuntu-latest
|
9 | 13 | steps:
|
10 |
| - - uses: actions/checkout@master |
11 |
| - - name: Set up Python 3.10 |
12 |
| - uses: actions/setup-python@v3 |
13 |
| - with: |
14 |
| - python-version: "3.10" |
15 |
| - - name: Install pypa/build |
16 |
| - run: | |
17 |
| - python -m pip install build --user |
18 |
| - - name: Build a binary wheel and a source tarball |
19 |
| - run: | |
20 |
| - python -m pip install -r requirements.txt |
21 |
| - python -m build --sdist --wheel --outdir dist/. |
| 14 | + - name: Checkout code |
| 15 | + uses: actions/checkout@v2 |
| 16 | + - name: Set up Python |
| 17 | + uses: actions/setup-python@v2 |
| 18 | + with: |
| 19 | + python-version: '3.x' |
| 20 | + - name: Install dependencies |
| 21 | + run: | |
| 22 | + python -m pip install --upgrade pip wheel |
| 23 | + pip install -r requirements.txt |
| 24 | + - name: Build |
| 25 | + run: | |
| 26 | + python setup.py sdist bdist_wheel |
| 27 | + - name: Get version number |
| 28 | + id: get_version |
| 29 | + run: echo "VERSION=$(python3 -c "import sky130ph; print(sky130ph.__version__)")" >> $GITHUB_ENV |
| 30 | + - name: Load Release text |
| 31 | + run: | |
| 32 | + BODY=$(cat ./docs/changelog/${{ env.VERSION }}-changelog.md) |
| 33 | + BODY="${BODY//'%'/'%25'}" |
| 34 | + BODY="${BODY//$'\n'/'%0A'}" |
| 35 | + BODY="${BODY//$'\r'/'%0D'}" |
| 36 | + echo "BODY=$BODY" >> $GITHUB_ENV |
| 37 | + - name: Publish to PyPI |
| 38 | + |
| 39 | + with: |
| 40 | + user: __token__ |
| 41 | + password: ${{ secrets.PYPI_API_TOKEN }} |
| 42 | + - name: Create Release |
| 43 | + id: create_release |
| 44 | + uses: actions/create-release@v1 |
| 45 | + env: |
| 46 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token |
| 47 | + with: |
| 48 | + tag_name: ${{ github.ref }} |
| 49 | + release_name: sky130ph ${{ env.VERSION }} |
| 50 | + body: ${{ env.BODY }} |
| 51 | + draft: false |
| 52 | + prerelease: false |
0 commit comments