From adcb47ea7ff19c2dc227cfcd9e2b08bb93629dab Mon Sep 17 00:00:00 2001 From: Kamil Raczycki Date: Wed, 23 Nov 2022 19:38:45 +0100 Subject: [PATCH] ci: split workflow into 2 files (#105) --- .github/workflows/{full-ci.yml => ci-dev.yml} | 10 +-- .github/workflows/ci-prod.yml | 62 +++++++++++++++++++ 2 files changed, 63 insertions(+), 9 deletions(-) rename .github/workflows/{full-ci.yml => ci-dev.yml} (85%) create mode 100644 .github/workflows/ci-prod.yml diff --git a/.github/workflows/full-ci.yml b/.github/workflows/ci-dev.yml similarity index 85% rename from .github/workflows/full-ci.yml rename to .github/workflows/ci-dev.yml index bf17d4aa..155535ba 100644 --- a/.github/workflows/full-ci.yml +++ b/.github/workflows/ci-dev.yml @@ -1,10 +1,8 @@ -name: "Build & publish" +name: "Build & publish - DEV" on: push: branches: - main - tags: - - "**" jobs: run-tests: @@ -27,9 +25,6 @@ jobs: python-version: 3.8 architecture: x64 enable-pep582: true - - name: Publish distribution 📦 to PyPI - if: ${{ startsWith(github.ref, 'refs/tags') }} - run: pdm publish --repository pypi --username __token__ --password ${{ secrets.PYPI_API_TOKEN }} --verbose - run: pip install toml - uses: jannekem/run-python-script-action@v1 name: Rename test version @@ -79,6 +74,3 @@ jobs: git config --local user.name "github-actions[bot]" - name: Publish dev documentation run: mike deploy --push dev - - name: Publish latest documentation - if: ${{ startsWith(github.ref, 'refs/tags') }} - run: mike deploy --push --update-aliases ${{github.ref_name}} latest diff --git a/.github/workflows/ci-prod.yml b/.github/workflows/ci-prod.yml new file mode 100644 index 00000000..21d7bb0b --- /dev/null +++ b/.github/workflows/ci-prod.yml @@ -0,0 +1,62 @@ +name: "Build & publish - PROD" +on: + push: + tags: + - "**" + +jobs: + run-tests: + name: "Run tests job" + uses: ./.github/workflows/_tests.yml + + build-n-publish: + name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI + needs: [run-tests] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: 3.8 + - uses: pdm-project/setup-pdm@v3 + name: Setup PDM + with: + python-version: 3.8 + architecture: x64 + enable-pep582: true + - name: Publish distribution 📦 to PyPI + run: pdm publish --repository pypi --username __token__ --password ${{ secrets.PYPI_API_TOKEN }} --verbose + + generate-docs: + name: Publish library 📦 documentation 📄 to Github Pages 🌐 + needs: [run-tests] + runs-on: ubuntu-latest + env: + MKDOCS_EXECUTE_JUPYTER: true + steps: + - uses: actions/checkout@v2 + - name: Fetch gh-pages branch + run: git fetch origin gh-pages --depth=1 + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: 3.8 + - name: Install pdm + run: pip install pdm + - name: Generate requirements.txt + run: pdm export -d -G:all > requirements.txt + - name: Install dependencies + run: pip install -r requirements.txt + - name: Install geovoronoi dependency + run: pip install geovoronoi==0.4.0 + - name: Install self + run: | + pdm build -v -d dist + pip install $(find dist -name '*.whl') + - name: Configure Git user + run: | + git config --local user.email "github-actions[bot]@users.noreply.github.com" + git config --local user.name "github-actions[bot]" + - name: Publish latest documentation + run: mike deploy --push --update-aliases ${{github.ref_name}} latest