|
| 1 | +# SPDX-License-Identifier: BSD-3-Clause |
| 2 | +# Copyright (c) 2023 Scipp contributors (https://github.com/scipp) |
| 3 | + |
| 4 | +name: Release |
| 5 | + |
| 6 | +on: |
| 7 | + release: |
| 8 | + types: [published] |
| 9 | + workflow_dispatch: |
| 10 | + |
| 11 | +defaults: |
| 12 | + run: |
| 13 | + shell: bash -l {0} # required for conda env |
| 14 | + |
| 15 | +jobs: |
| 16 | + build_conda: |
| 17 | + name: Conda build |
| 18 | + runs-on: 'ubuntu-20.04' |
| 19 | + |
| 20 | + steps: |
| 21 | + - uses: actions/checkout@v3 |
| 22 | + with: |
| 23 | + submodules: true |
| 24 | + fetch-depth: 0 # history required so cmake can determine version |
| 25 | + |
| 26 | + - uses: mamba-org/setup-micromamba@v1 |
| 27 | + with: |
| 28 | + environment-name: build-env |
| 29 | + create-args: >- |
| 30 | + python=3.8 |
| 31 | + conda-build |
| 32 | + boa |
| 33 | + - run: conda mambabuild --channel conda-forge --channel scipp --python=3.8 --no-anaconda-upload --override-channels --output-folder conda/package conda |
| 34 | + |
| 35 | + - uses: actions/upload-artifact@v3 |
| 36 | + with: |
| 37 | + name: conda-package-noarch |
| 38 | + path: conda/package/*/essreflectometry*.tar.bz2 |
| 39 | + |
| 40 | + build_wheels: |
| 41 | + name: Wheels |
| 42 | + runs-on: 'ubuntu-20.04' |
| 43 | + |
| 44 | + steps: |
| 45 | + - uses: actions/checkout@v3 |
| 46 | + with: |
| 47 | + fetch-depth: 0 # history required so setuptools_scm can determine version |
| 48 | + |
| 49 | + - uses: actions/setup-python@v3 |
| 50 | + with: |
| 51 | + python-version: '3.8' |
| 52 | + |
| 53 | + - run: python -m pip install --upgrade pip |
| 54 | + - run: python -m pip install -r requirements/wheels.txt |
| 55 | + |
| 56 | + - name: Build wheels |
| 57 | + run: python -m build |
| 58 | + |
| 59 | + - name: Upload wheels |
| 60 | + uses: actions/upload-artifact@v3 |
| 61 | + with: |
| 62 | + name: dist |
| 63 | + path: dist |
| 64 | + |
| 65 | + upload_pypi: |
| 66 | + name: Deploy PyPI |
| 67 | + needs: [build_wheels, build_conda] |
| 68 | + runs-on: 'ubuntu-20.04' |
| 69 | + environment: release |
| 70 | + permissions: |
| 71 | + id-token: write |
| 72 | + if: github.event_name == 'release' && github.event.action == 'published' |
| 73 | + steps: |
| 74 | + - uses: actions/download-artifact@v3 |
| 75 | + |
| 76 | + |
| 77 | + upload_conda: |
| 78 | + name: Deploy Conda |
| 79 | + needs: [build_wheels, build_conda] |
| 80 | + runs-on: 'ubuntu-20.04' |
| 81 | + if: github.event_name == 'release' && github.event.action == 'published' |
| 82 | + |
| 83 | + steps: |
| 84 | + - uses: actions/download-artifact@v3 |
| 85 | + - uses: mamba-org/setup-micromamba@v1 |
| 86 | + with: |
| 87 | + environment-name: upload-env |
| 88 | + create-args: >- |
| 89 | + python=3.8 |
| 90 | + anaconda-client |
| 91 | +
|
| 92 | + - run: anaconda --token ${{ secrets.ANACONDATOKEN }} upload --user scipp --label main $(ls conda-package-*/*/*.tar.bz2) |
| 93 | + |
| 94 | + docs: |
| 95 | + needs: [upload_conda, upload_pypi] |
| 96 | + uses: ./.github/workflows/docs.yml |
| 97 | + with: |
| 98 | + publish: ${{ github.event_name == 'release' && github.event.action == 'published' }} |
| 99 | + secrets: inherit |
| 100 | + |
| 101 | + |
| 102 | + assets: |
| 103 | + name: Upload docs |
| 104 | + needs: docs |
| 105 | + runs-on: 'ubuntu-20.04' |
| 106 | + permissions: |
| 107 | + contents: write # This is needed so that the action can upload the asset |
| 108 | + |
| 109 | + steps: |
| 110 | + - uses: actions/download-artifact@v3 |
| 111 | + - name: Zip documentation |
| 112 | + run: | |
| 113 | + mv docs_html documentation-${{ github.ref_name }} |
| 114 | + zip -r documentation-${{ github.ref_name }}.zip documentation-${{ github.ref_name }} |
| 115 | + - name: Upload release assets |
| 116 | + uses: svenstaro/upload-release-action@v2 |
| 117 | + with: |
| 118 | + file: ./documentation-${{ github.ref_name }}.zip |
| 119 | + overwrite: false |
| 120 | + |
0 commit comments