Add gitea deploy workflow
Some checks failed
CI/CD Pipeline / build (push) Failing after 2s
CI/CD Pipeline / deploy-test (push) Has been skipped
CI/CD Pipeline / deploy-prod (push) Has been skipped
CI/CD Pipeline / publish (push) Has been skipped
CI/CD Pipeline / cleanup (push) Failing after 0s

This commit is contained in:
usov_i 2025-03-31 14:02:30 +02:00
parent c2d6f6b259
commit a2be993c0b

View File

@ -0,0 +1,79 @@
name: CI/CD Pipeline
on:
push:
branches:
- main
tags:
- '*'
jobs:
build:
runs-on: pyzebra
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Conda
run: |
source /opt/miniconda3/etc/profile.d/conda.sh
conda config --add channels conda-forge
conda config --set solver libmamba
- name: Determine build path
id: build_path
run: |
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
echo "BUILD_PATH=${{ runner.temp }}/build-prod" >> $GITHUB_ENV
else
echo "BUILD_PATH=${{ runner.temp }}/build-test" >> $GITHUB_ENV
fi
- name: Build Conda package
run: |
conda build --no-anaconda-upload --output-folder $BUILD_PATH ./conda-recipe
deploy-test:
runs-on: pyzebra
needs: build
if: github.ref == 'refs/heads/main'
steps:
- name: Deploy to testing
run: |
source /opt/miniconda3/etc/profile.d/conda.sh
conda activate test
conda install --channel $BUILD_PATH --force-reinstall pyzebra -y
sudo systemctl restart pyzebra-test.service
deploy-prod:
runs-on: pyzebra
needs: build
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Deploy to production
run: |
source /opt/miniconda3/etc/profile.d/conda.sh
conda activate prod
conda install --channel $BUILD_PATH pyzebra -y
sudo systemctl restart pyzebra-prod.service
publish:
runs-on: pyzebra
needs: deploy-prod
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Publish to Anaconda
run: |
source /opt/miniconda3/etc/profile.d/conda.sh
conda activate base
anaconda --token ${{ secrets.ANACONDA_TOKEN }} upload $(conda build --output-folder $BUILD_PATH ./conda-recipe --output)
cleanup:
runs-on: pyzebra
needs: [build, deploy-test, deploy-prod, publish]
if: always()
steps:
- name: Cleanup
run: |
rm -rf $BUILD_PATH
conda build purge-all