cd #181
Workflow file for this run
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: cd | |
on: | |
release: | |
types: | |
- published | |
permissions: | |
id-token: write | |
contents: read | |
jobs: | |
publish_to_pypi: | |
name: publish to pypi on new release | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # Fetch all history for all branches and tags | |
- name: Define the root dir | |
run: | | |
root_dir=$(pwd) | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.x" | |
- name: Install Poetry | |
run: | | |
curl -sSL https://install.python-poetry.org | python3 - | |
- name: Configure Poetry | |
env: | |
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} | |
run: | | |
poetry config pypi-token.pypi $PYPI_TOKEN | |
- name: Build and publish changed extensions | |
run: | | |
# Get the latest tag | |
latest_tag=$(git describe --tags --abbrev=0) | |
find extensions -name pyproject.toml | while read -r project; do | |
dir=$(dirname "$project") | |
echo "Checking changes in $dir" | |
# Check if there are any changes in the extension directory since the last tag | |
if git diff --quiet $latest_tag HEAD -- "$dir"; then | |
echo "No changes in $dir since last release. Skipping." | |
else | |
echo "Changes detected in $dir. Building and publishing." | |
cd "$dir" | |
poetry build | |
poetry publish | |
cd $root_dir | |
fi | |
done | |
- name: Build and publish main package | |
run: | | |
cd $root_dir | |
poetry build | |
poetry publish |