Skip to content

Bump actions/upload-artifact from 2 to 4 #176

Bump actions/upload-artifact from 2 to 4

Bump actions/upload-artifact from 2 to 4 #176

Workflow file for this run

name: Build and publish package and docs
on:
push:
branches:
- master
tags:
- v[0-9].[0-9]+.[0-9]+
pull_request:
branches:
- master
jobs:
build:
name: Install and build
runs-on: ubuntu-latest
steps:
-
name: Checkout repo
uses: actions/checkout@v4
-
name: Set up Python 3.8
uses: actions/setup-python@v5
with:
python-version: 3.8
-
name: Install dependencies
run: |
python -m pip install wheel # https://stackoverflow.com/questions/34819221
python -m pip install cython
-
name: Install
run: |
python -m pip install --no-cache-dir -e .[dev]
python -c "from setuptools_scm import get_version;get_version('.', write_to='src/rapid_clay_formations_fab/_version.py')"
-
name: Test
run: |
invoke test
-
name: Build docs
run: |
invoke docs
-
name: Upload docs for other jobs
uses: actions/upload-artifact@v4
with:
name: docs-dir
path: dist/docs/
if-no-files-found: error
retention-days: 1
-
name: Build package
run: |
python setup.py clean --all sdist bdist_wheel
-
name: Upload package artifacts for other jobs
uses: actions/upload-artifact@v4
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
with:
name: dist-files
path: |
dist/*.whl
dist/*.tar.gz
if-no-files-found: error
retention-days: 1
publish_docs:
name: Publish docs
needs: build
if: github.event_name == 'push' && ! startsWith(github.ref, 'refs/tags')
runs-on: ubuntu-latest
steps:
-
name: Download docs directory from build job
uses: actions/download-artifact@v2
with:
name: docs-dir
path: docs
-
name: Publish docs on branch gh-pages
uses: crazy-max/[email protected]
with:
target_branch: gh-pages
build_dir: docs
jekyll: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish_pkg:
name: Publish package on pypi and GitHub
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
steps:
-
name: Checkout code # This is needed for creating release on GitHub
uses: actions/checkout@v4
-
name: Download dist directory from build job
uses: actions/download-artifact@v2
with:
name: dist-files
path: dist
-
name: Upload and release package on PyPi
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypi_password }}
-
name: Create GitHub release and upload assets
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: |
dist/*.whl
dist/*.tar.gz