Skip to content

Update deps and migrate to ruff #105

Update deps and migrate to ruff

Update deps and migrate to ruff #105

Workflow file for this run

name: Build & Deploy Quackstack
on:
push:
branches:
- main
pull_request:
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Python Dependencies
uses: HassanAbouelela/actions/setup-python@setup-python_v1.4.1
with:
python_version: '3.10'
- name: Run pre-commit hooks
run: SKIP=ruff pre-commit run --all-files
# Run `ruff` using github formatting to enable automatic inline annotations.
- name: Run ruff
run: "ruff check --format=github ."
build:
name: Build & Push Docker image
runs-on: ubuntu-latest
needs: [lint]
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
steps:
- name: Create SHA Container Tag
id: sha_tag
run: |
tag=$(cut -c 1-7 <<< $GITHUB_SHA)
echo "::set-output name=tag::$tag"
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Github Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
push: true
cache-from: type=registry,ref=ghcr.io/python-discord/quackstack:main
cache-to: type=inline
tags: |
ghcr.io/python-discord/quackstack:main
ghcr.io/python-discord/quackstack:${{ steps.sha_tag.outputs.tag }}
deploy:
name: Deploy to Kubernetes
runs-on: ubuntu-latest
needs: [build]
steps:
- name: Create SHA Container Tag
id: sha_tag
run: |
tag=$(cut -c 1-7 <<< $GITHUB_SHA)
echo "::set-output name=tag::$tag"
# Check out the private Kubernetes repository for the
# deployment.yaml file using a GitHub Personal Access
# Token to get access.
- name: Checkout code
uses: actions/checkout@v4
with:
repository: python-discord/infra
path: infra
- uses: azure/setup-kubectl@v3
- name: Authenticate with Kubernetes
uses: azure/k8s-set-context@v3
with:
method: kubeconfig
kubeconfig: ${{ secrets.KUBECONFIG }}
- name: Deploy to Kubernetes
uses: azure/k8s-deploy@v4
with:
manifests: |
infra/kubernetes/namespaces/default/quackstack/deployment.yaml
images: 'ghcr.io/python-discord/quackstack:${{ steps.sha_tag.outputs.tag }}'