Merge pull request #360 from DESm1th/0.2.1 #1
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: Create and publish release | |
on: | |
push: | |
tags: | |
- "v*.*.*" | |
- "*.*.*" | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
create-release: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Update changelog | |
uses: ./.github/update_changelog | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Update .zenodo.json creators list | |
uses: ./.github/update_zenodo | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Make release | |
uses: softprops/action-gh-release@v1 | |
with: | |
body: ${{ steps.make_changelog.outputs.changelog }} | |
build-package: | |
needs: create-release | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ./.github/setup_datman | |
- name: Install build packages | |
run: python -m pip install .[build] | |
- name: Create package | |
run: python -m build | |
- name: Check sdist | |
run: "twine check dist/datman-*.tar.gz" | |
- name: Check wheel | |
run: "twine check dist/datman-*.whl" | |
- name: Cache build results | |
uses: actions/cache@v3 | |
with: | |
path: ./dist | |
key: datman-${GITHUB_REF#refs/*/} | |
push-testpypi: | |
needs: build-package | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Get build cache | |
uses: actions/cache@v3 | |
with: | |
path: ./dist | |
key: datman-${GITHUB_REF#refs/*/} | |
- name: Publish to test-pypi | |
uses: pypa/[email protected] | |
with: | |
password: ${{ secrets.TESTPYPI_API_TOKEN }} | |
repository_url: https://test.pypi.org/legacy/ | |
check-package-install: | |
needs: push-testpypi | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Setup python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.8 | |
cache: pip | |
- name: Update pip | |
run: python -m pip install --upgrade pip | |
- name: Install datman from test-pypi server | |
run: | | |
pip install --index-url https://test.pypi.org/simple/ \ | |
--extra-index-url https://pypi.org/simple \ | |
datman==${GITHUB_REF#refs/*/} | |
shell: bash | |
- name: Ensure correct version is installed | |
run: | | |
VERSION=`python -c "import datman; print(datman.__version__)"` | |
tmp="${GITHUB_REF#refs/*/}" | |
EXPECTED=${tmp#v*} | |
if [ "$VERSION" != "${EXPECTED}" ]; then | |
exit 1 | |
fi | |
shell: bash | |
push-pypi: | |
needs: check-package-install | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Get build cache | |
uses: actions/cache@v3 | |
with: | |
path: ./dist | |
key: datman-${GITHUB_REF#refs/*/} | |
- name: Publish to pypi | |
uses: pypa/[email protected] | |
with: | |
password: ${{ secrets.PYPI_API_TOKEN }} |