Finishing CI/CD workflow #5
This file contains hidden or 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: ci-cd | |
| on: [push, pull_request] | |
| jobs: | |
| build-conda: | |
| name: Build Conda package | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| # Build the Conda package using rattler-build | |
| - name: Build Conda package | |
| uses: prefix-dev/[email protected] | |
| with: | |
| recipe-path: rattler.recipe/recipe.yaml | |
| - name: Store the Conda package | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: nanofase | |
| path: output/ | |
| deploy-conda: | |
| name: Deploy package on Anaconda | |
| runs-on: ubuntu-latest | |
| needs: build-conda | |
| # Only run if a new tag is pushed | |
| if: startsWith(github.ref, 'refs/tags/') | |
| steps: | |
| - name: Retrieve the package | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: nanofase | |
| path: output/ | |
| # Install the Anaconda client using Mamba | |
| - name: Install Anaconda client | |
| uses: mamba-org/setup-micromamba@v2 | |
| with: | |
| environment-name: deploy | |
| generate-run-shell: true | |
| create-args: >- | |
| python=3.10 | |
| anaconda-client | |
| - name: Upload to Anaconda | |
| env: | |
| ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_API_SECRET }} | |
| run: | | |
| shopt -s nullglob | |
| EXIT_CODE=0 | |
| for pkg in $(find output -type f \( -name "*.conda" -o -name "*.tar.bz2" \) ); do | |
| if ! anaconda upload --user samharrison7 "${pkg}"; then | |
| EXIT_CODE=1 | |
| fi | |
| done | |
| shell: micromamba-shell {0} |