Merge pull request #14 from Loop3D/release-please--branches--main #61
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
on: | |
push: | |
name: Release | |
jobs: | |
linting: | |
uses: Loop3d/workflows/.github/workflows/python_linting.yml@main | |
with: | |
folder-name: '.' | |
release-please: | |
runs-on: ubuntu-latest | |
needs: ["linting"] | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- uses: GoogleCloudPlatform/release-please-action@v4 | |
id: release | |
with: | |
release-type: python | |
package-name: loopstructuralvisualisation | |
version-file: loopstructuralvisualisation/version.py | |
outputs: | |
release_created: ${{ steps.release.outputs.release_created }} | |
conda-build: | |
name: Building conda package for python | |
needs: ["release-please"] | |
if: github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
os: ["ubuntu-latest"] | |
python-version: ${{ fromJSON(vars.PYTHON_VERSIONS)}} | |
steps: | |
- uses: conda-incubator/setup-miniconda@v3 | |
with: | |
auto-update-conda: true | |
python-version: ${{ matrix.python-version }} | |
- uses: actions/checkout@v4 | |
- name: update submodules | |
# shell: bash -l {0} | |
run: | | |
git submodule update --init --recursive | |
- name: Conda build | |
env: | |
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_TOKEN }} | |
shell: bash -l {0} | |
run: | | |
conda install --solver=classic -c conda-forge conda-build anaconda-client conda-libmamba-solver -y | |
conda build -c conda-forge -c loop3d --output-folder conda conda --python ${{matrix.python-version}} | |
conda convert -p all conda/linux-64/*.tar.bz2 -f -o conda | |
- name: upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: conda-${{ matrix.os }}-${{ matrix.python-version }} | |
path: conda | |
make_sdist: | |
needs: ["release-please"] | |
name: Make SDist | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build SDist | |
run: | | |
pip install build | |
python -m build | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: dist | |
path: dist/ | |
upload_to_pypi: | |
runs-on: "ubuntu-latest" | |
needs: ["release-please", "make_sdist"] | |
if: ${{ needs.release-please.outputs.release_created }} | |
permissions: | |
# IMPORTANT: this permission is mandatory for trusted publishing | |
id-token: write | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: dist | |
path: dist | |
- uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
skip_existing: true | |
verbose: true | |
upload_to_conda: | |
needs: ["release-please", "conda-build"] | |
runs-on: ${{matrix.os}} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: ["ubuntu-latest"] | |
python-version: ${{ fromJSON(vars.PYTHON_VERSIONS)}} | |
if: ${{ needs.release-please.outputs.release_created }} | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: conda-${{ matrix.os }}-${{ matrix.python-version }} | |
path: conda | |
- uses: conda-incubator/setup-miniconda@v3 | |
- name: upload all files to conda-forge | |
shell: bash -l {0} | |
env: | |
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_TOKEN }} | |
run: | | |
conda install -c anaconda anaconda-client -y | |
anaconda upload --label main conda/*/*.tar.bz2 |