From d5b72de4bb0fe892410180a67c23556db6726e67 Mon Sep 17 00:00:00 2001 From: Sebastian Ehlert <28669218+awvwgk@users.noreply.github.com> Date: Sun, 6 Nov 2022 10:11:27 +0100 Subject: [PATCH] Add deployment workflow --- .github/workflows/wheel.yml | 78 ++++++++++++++++++++++++++++++++++++- subprojects/mctc-lib.wrap | 2 +- subprojects/toml-f.wrap | 2 +- 3 files changed, 79 insertions(+), 3 deletions(-) diff --git a/.github/workflows/wheel.yml b/.github/workflows/wheel.yml index c91d2372..9fef3f81 100644 --- a/.github/workflows/wheel.yml +++ b/.github/workflows/wheel.yml @@ -1,8 +1,33 @@ name: wheel -on: [push, workflow_dispatch] +on: + push: + workflow_dispatch: + release: + types: [published] jobs: + source: + runs-on: ubuntu-latest + defaults: + run: + shell: bash -l {0} + steps: + - uses: actions/checkout@v3 + - name: Setup Python + uses: mamba-org/provision-with-micromamba@main + with: + environment-file: assets/ci/build-env.yaml + - run: | + meson setup _build + meson dist -C _build --no-tests --include-subprojects + mv _build/meson-dist/*.tar.xz . + - uses: actions/upload-artifact@v3 + with: + name: dftd3-source + path: ./*.tar.xz + retention-days: 5 + sdist: runs-on: ubuntu-latest defaults: @@ -86,3 +111,54 @@ jobs: name: dftd3-python-${{ matrix.python }} path: ./*.whl retention-days: 5 + + release: + needs: + - source + - sdist + - manylinux + runs-on: ubuntu-latest + steps: + - name: Download artifacts + uses: actions/download-artifact@v2 + with: + path: ${{ github.workspace }} # This will download all files + + - name: Create SHA256 checksums + run: | + set -ex + for output in dftd3*/*dftd3*; do + pushd $(dirname "$output") + sha256sum $(basename "$output") | tee $(basename "$output").sha256 + popd + done + + - name: Copy release artifacts + run: | + mkdir dist/ + cp -v dftd3*/dftd3*.whl dftd3*/dftd3*.tar.gz dist/ + + - name: Publish to Test PyPI + if: ${{ github.event_name == 'release' }} + uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + password: ${{ secrets.TEST_PYPI_TOKEN }} + repository_url: https://test.pypi.org/legacy/ + + - name: Upload assets + uses: svenstaro/upload-release-action@v2 + if: ${{ github.event_name == 'release' }} + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: dftd3*/*dftd3* + file_glob: true + tag: ${{ github.ref }} + overwrite: true + + - name: Publish to PyPI + if: ${{ github.event_name == 'release' }} + uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + password: ${{ secrets.PYPI_TOKEN }} diff --git a/subprojects/mctc-lib.wrap b/subprojects/mctc-lib.wrap index 5a16f50d..f3f6e673 100644 --- a/subprojects/mctc-lib.wrap +++ b/subprojects/mctc-lib.wrap @@ -1,4 +1,4 @@ [wrap-git] directory = mctc-lib url = https://github.com/grimme-lab/mctc-lib -revision = v0.3.0 +revision = v0.3.1 diff --git a/subprojects/toml-f.wrap b/subprojects/toml-f.wrap index 0db5489f..2ebd4f3e 100644 --- a/subprojects/toml-f.wrap +++ b/subprojects/toml-f.wrap @@ -1,4 +1,4 @@ [wrap-git] directory = toml-f url = https://github.com/toml-f/toml-f -revision = v0.2.2 +revision = v0.2.4