Add gitea deploy workflow
Some checks failed
Some checks failed
This commit is contained in:
parent
c2d6f6b259
commit
a9e224ab56
81
.gitea/workflows/deploy.yaml
Normal file
81
.gitea/workflows/deploy.yaml
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
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: |
|
||||||
|
source /opt/miniconda3/etc/profile.d/conda.sh
|
||||||
|
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: |
|
||||||
|
source /opt/miniconda3/etc/profile.d/conda.sh
|
||||||
|
rm -rf $BUILD_PATH
|
||||||
|
conda build purge-all
|
Loading…
x
Reference in New Issue
Block a user