name: pyzebra CI/CD pipeline on: push: branches: - main tags: - '*' env: CONDA: /opt/miniconda3 jobs: prepare: runs-on: pyzebra steps: - run: $CONDA/bin/conda config --add channels conda-forge - run: $CONDA/bin/conda config --set solver libmamba test-env: runs-on: pyzebra needs: prepare if: github.ref == 'refs/heads/main' env: BUILD_DIR: ${{ runner.temp }}/conda_build steps: - name: Checkout repository uses: actions/checkout@v4 - run: $CONDA/bin/conda build --no-anaconda-upload --output-folder $BUILD_DIR ./conda-recipe - run: $CONDA/bin/conda remove --name test --all --keep-env -y - run: $CONDA/bin/conda install --name test --channel $BUILD_DIR python=3.8 pyzebra -y - run: sudo systemctl restart pyzebra-test.service prod-env: runs-on: pyzebra needs: prepare if: startsWith(github.ref, 'refs/tags/') env: BUILD_DIR: ${{ runner.temp }}/conda_build steps: - name: Checkout repository uses: actions/checkout@v4 - run: $CONDA/bin/conda build --token ${{ secrets.ANACONDA_TOKEN }} --output-folder $BUILD_DIR ./conda-recipe - run: $CONDA/bin/conda remove --name prod --all --keep-env -y - run: $CONDA/bin/conda install --name prod --channel $BUILD_DIR python=3.8 pyzebra -y - run: sudo systemctl restart pyzebra-prod.service cleanup: runs-on: pyzebra needs: [test-env, prod-env] if: always() steps: - run: $CONDA/bin/conda build purge-all