|
| 1 | +name: Continuous Deployment |
| 2 | + |
| 3 | +# only allow one deploy workflow to be running at a time |
| 4 | +# serializes multiple outstanding deploys if PRs are merged before the last deploy finishes |
| 5 | +# ref: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#concurrency |
| 6 | +concurrency: deploy |
| 7 | + |
| 8 | +# Only trigger the workflow when pushing to master or a label is applied to a |
| 9 | +# Pull Request |
| 10 | +on: |
| 11 | + push: |
| 12 | + branches: |
| 13 | + - main |
| 14 | + paths-ignore: |
| 15 | + - "*.md" |
| 16 | + - .pre-commit-config.yaml |
| 17 | + - .github/** |
| 18 | + - "!.github/workflows/cd.yml" |
| 19 | + |
| 20 | +# Global environment variables |
| 21 | +env: |
| 22 | + KUBECTL_VERSION: "v1.29.15" |
| 23 | + HELM_VERSION: "v3.12.0" |
| 24 | + KUBECONFIG: secrets/ovh-kubeconfig.yaml |
| 25 | + |
| 26 | +jobs: |
| 27 | + # In this dedicated job to deploy our staging environment we build and push |
| 28 | + # images that the jobs to deploy to the production environments depend on. |
| 29 | + deploy: |
| 30 | + runs-on: ubuntu-24.04 |
| 31 | + |
| 32 | + steps: |
| 33 | + - name: Checkout repo |
| 34 | + uses: actions/checkout@v4 |
| 35 | + with: |
| 36 | + fetch-depth: 0 |
| 37 | + |
| 38 | + - name: Setup Python |
| 39 | + uses: actions/setup-python@v5 |
| 40 | + with: |
| 41 | + python-version: "3.13" |
| 42 | + cache: pip |
| 43 | + |
| 44 | + - name: "Stage 1: Install dependencies" |
| 45 | + run: | |
| 46 | + pip install --upgrade setuptools pip |
| 47 | + pip install --upgrade -r requirements.txt |
| 48 | +
|
| 49 | + - name: "Stage 1: Install kubectl ${{ env.KUBECTL_VERSION }}" |
| 50 | + uses: azure/setup-kubectl@v4 |
| 51 | + with: |
| 52 | + version: ${{ env.KUBECTL_VERSION }} |
| 53 | + |
| 54 | + - name: "Stage 1: Install and setup helm ${{ env.HELM_VERSION }}" |
| 55 | + run: | |
| 56 | + curl -sf https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | DESIRED_VERSION=${HELM_VERSION} bash |
| 57 | +
|
| 58 | + - name: Unlock git-crypt secrets |
| 59 | + uses: sliteteam/github-action-git-crypt-unlock@f99c0c6b60bb7ec30dcec033a8f0a3b3d48f21e1 |
| 60 | + env: |
| 61 | + GIT_CRYPT_KEY: ${{ secrets.GIT_CRYPT_KEY }} |
| 62 | + |
| 63 | + - name: get nbviewer chart |
| 64 | + run: | |
| 65 | + git clone https://github.com/jupyter/nbviewer |
| 66 | + cd nbviewer |
| 67 | + git reset "${NBVIEWER_VERSION}" --hard |
| 68 | + git log -1 |
| 69 | +
|
| 70 | + - name: deploy |
| 71 | + run: | |
| 72 | + bash deploy.sh |
| 73 | +
|
| 74 | + - name: "Test" |
| 75 | + run: | |
| 76 | + pytest |
0 commit comments