Skip to content

Commit

Permalink
change the publish.yml (inspired from cdsodatacli) to enable the pypi…
Browse files Browse the repository at this point in the history
… push
  • Loading branch information
agrouaze committed Dec 14, 2023
1 parent b58d393 commit 672b1c3
Showing 1 changed file with 36 additions and 14 deletions.
50 changes: 36 additions & 14 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,54 @@
name: Upload package to PyPI
name: Upload Package to PyPI

on:
release:
types: [created]

jobs:
publish:
name: Publish to PyPI
build:
name: Build packages
runs-on: ubuntu-latest
if: github.repository == 'umr-lops/L2A-wind-direction-processor'
steps:
- uses: actions/checkout@v4
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.x'
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip build twine
python -m pip install --upgrade pip
python -m pip install build twine
- name: Build
run: |
python -m build --sdist --wheel .
python -m build --sdist --outdir dist/ .
- name: Check the built archives
run: |
twine check dist/*
pip install dist/*.whl
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
password: ${{ secrets.pypi_token }}
repository_url: https://upload.pypi.org/legacy/
verify_metadata: true
name: packages
path: dist/*

pypi-publish:
name: Upload to PyPI
runs-on: ubuntu-latest
needs: build

environment:
name: pypi
url: https://pypi.org/p/l2awinddirection
permissions:
id-token: write

steps:
- name: Download build artifacts
uses: actions/download-artifact@v3
with:
name: packages
path: dist/

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@2f6f737ca5f74c637829c0f5c3acd0e29ea5e8bf

0 comments on commit 672b1c3

Please sign in to comment.