|
1 | 1 | name: wheel
|
2 | 2 |
|
3 |
| -on: [push, workflow_dispatch] |
| 3 | +on: |
| 4 | + push: |
| 5 | + workflow_dispatch: |
| 6 | + release: |
| 7 | + types: [published] |
4 | 8 |
|
5 | 9 | jobs:
|
| 10 | + source: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + defaults: |
| 13 | + run: |
| 14 | + shell: bash -l {0} |
| 15 | + steps: |
| 16 | + - uses: actions/checkout@v3 |
| 17 | + - name: Setup Python |
| 18 | + uses: mamba-org/provision-with-micromamba@main |
| 19 | + with: |
| 20 | + environment-file: assets/ci/build-env.yaml |
| 21 | + - run: | |
| 22 | + meson setup _build |
| 23 | + meson dist -C _build --no-tests --include-subprojects |
| 24 | + mv _build/meson-dist/*.tar.xz . |
| 25 | + - uses: actions/upload-artifact@v3 |
| 26 | + with: |
| 27 | + name: dftd3-source |
| 28 | + path: ./*.tar.xz |
| 29 | + retention-days: 5 |
| 30 | + |
6 | 31 | sdist:
|
7 | 32 | runs-on: ubuntu-latest
|
8 | 33 | defaults:
|
@@ -86,3 +111,54 @@ jobs:
|
86 | 111 | name: dftd3-python-${{ matrix.python }}
|
87 | 112 | path: ./*.whl
|
88 | 113 | retention-days: 5
|
| 114 | + |
| 115 | + release: |
| 116 | + needs: |
| 117 | + - source |
| 118 | + - sdist |
| 119 | + - manylinux |
| 120 | + runs-on: ubuntu-latest |
| 121 | + steps: |
| 122 | + - name: Download artifacts |
| 123 | + uses: actions/download-artifact@v2 |
| 124 | + with: |
| 125 | + path: ${{ github.workspace }} # This will download all files |
| 126 | + |
| 127 | + - name: Create SHA256 checksums |
| 128 | + run: | |
| 129 | + set -ex |
| 130 | + for output in dftd3*/*dftd3*; do |
| 131 | + pushd $(dirname "$output") |
| 132 | + sha256sum $(basename "$output") | tee $(basename "$output").sha256 |
| 133 | + popd |
| 134 | + done |
| 135 | +
|
| 136 | + - name: Copy release artifacts |
| 137 | + run: | |
| 138 | + mkdir dist/ |
| 139 | + cp -v dftd3*/dftd3*.whl dftd3*/dftd3*.tar.gz dist/ |
| 140 | +
|
| 141 | + - name: Publish to Test PyPI |
| 142 | + if: ${{ github.event_name == 'release' }} |
| 143 | + uses: pypa/gh-action-pypi-publish@release/v1 |
| 144 | + with: |
| 145 | + user: __token__ |
| 146 | + password: ${{ secrets.TEST_PYPI_TOKEN }} |
| 147 | + repository_url: https://test.pypi.org/legacy/ |
| 148 | + |
| 149 | + - name: Upload assets |
| 150 | + uses: svenstaro/upload-release-action@v2 |
| 151 | + if: ${{ github.event_name == 'release' }} |
| 152 | + with: |
| 153 | + repo_token: ${{ secrets.GITHUB_TOKEN }} |
| 154 | + file: dftd3*/*dftd3* |
| 155 | + file_glob: true |
| 156 | + tag: ${{ github.ref }} |
| 157 | + overwrite: true |
| 158 | + |
| 159 | + - name: Publish to PyPI |
| 160 | + if: ${{ github.event_name == 'release' }} |
| 161 | + uses: pypa/gh-action-pypi-publish@release/v1 |
| 162 | + with: |
| 163 | + user: __token__ |
| 164 | + password: ${{ secrets.PYPI_TOKEN }} |
0 commit comments