|
| 1 | +name: Release |
| 2 | + |
| 3 | +permissions: |
| 4 | + contents: write |
| 5 | + pages: write |
| 6 | + |
| 7 | +on: |
| 8 | + push: |
| 9 | + branches: |
| 10 | + - main |
| 11 | + |
| 12 | +jobs: |
| 13 | + release: |
| 14 | + name: Release |
| 15 | + runs-on: ubuntu-latest |
| 16 | + steps: |
| 17 | + - name: Check out the repository |
| 18 | + uses: actions/checkout@v4 |
| 19 | + with: |
| 20 | + fetch-depth: 2 |
| 21 | + |
| 22 | + - name: Set up Python |
| 23 | + |
| 24 | + with: |
| 25 | + python-version: "3.10.0" |
| 26 | + |
| 27 | + - name: Install uv |
| 28 | + uses: astral-sh/setup-uv@v5 |
| 29 | + with: |
| 30 | + # Install a specific version of uv. |
| 31 | + version: "0.5.2" |
| 32 | + |
| 33 | + - name: Check if there is a parent commit |
| 34 | + id: check-parent-commit |
| 35 | + run: | |
| 36 | + echo "::set-output name=sha::$(git rev-parse --verify --quiet HEAD^)" |
| 37 | +
|
| 38 | + - name: Detect and tag new version |
| 39 | + id: check-version |
| 40 | + if: steps.check-parent-commit.outputs.sha |
| 41 | + |
| 42 | + with: |
| 43 | + version-command: | |
| 44 | + uvx --from=toml-cli toml get --toml-path=pyproject.toml project.version |
| 45 | +
|
| 46 | + - name: Bump version for developmental release |
| 47 | + if: "! steps.check-version.outputs.tag" |
| 48 | + run: | |
| 49 | + uv run version_bumper.py && |
| 50 | + version=$(uvx --from=toml-cli toml get --toml-path=pyproject.toml project.version) && |
| 51 | + uvx --from=toml-cli toml set --toml-path=pyproject.toml project.version $version.dev.$(date +%s) |
| 52 | +
|
| 53 | +
|
| 54 | + # Add geospatial |
| 55 | + # Add the Ubuntu GIS PPA |
| 56 | + - name: install geospatial deps |
| 57 | + run: | |
| 58 | + sudo apt-get -y install software-properties-common |
| 59 | + sudo add-apt-repository ppa:ubuntugis/ppa && sudo apt-get update |
| 60 | + sudo apt-get -y install geos |
| 61 | + sudo apt-get -y install gdal-bin |
| 62 | + sudo apt-get -y install libgdal-dev |
| 63 | + export CPLUS_INCLUDE_PATH=/usr/include/gdal |
| 64 | + export C_INCLUDE_PATH=/usr/include/gdal |
| 65 | + sudo apt-get -y install proj-bin |
| 66 | +
|
| 67 | + - name: Install dependencies |
| 68 | + run: | |
| 69 | + uv sync |
| 70 | +
|
| 71 | + - name: Build book |
| 72 | + run: uv run jupyter-book build . --verbose |
| 73 | + |
| 74 | + - name: Publish |
| 75 | + if: steps.check-version.outputs.tag |
| 76 | + run: uv run ghp-import -n -p -f _build/html |
| 77 | + |
| 78 | + - name: Publish the release notes |
| 79 | + uses: release-drafter/[email protected] |
| 80 | + with: |
| 81 | + publish: ${{ steps.check-version.outputs.tag != '' }} |
| 82 | + tag: ${{ steps.check-version.outputs.tag }} |
| 83 | + env: |
| 84 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments