install python before pre-commit cache key #390
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
pull_request: | |
branches: | |
- "*" | |
push: | |
branches: | |
- main | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install uv | |
uses: astral-sh/setup-uv@v3 | |
with: | |
version: "0.4.24" | |
enable-cache: true | |
- name: Install Python | |
run: uv python install | |
- name: pre-commit cache key | |
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV | |
- uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pre-commit | |
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }} | |
- name: install dependencies | |
run: uv sync | |
- name: pre-commit | |
run: uv run pre-commit run --all-files | |
deploy: | |
needs: [lint] | |
if: ${{ github.event_name == 'push' }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and push | |
uses: docker/build-push-action@v6 | |
with: | |
push: true | |
# GIT_DIRTY=$(git status --porcelain=v1 2>/dev/null | wc -l) | |
build-args: | | |
GIT_BRANCH=${{ github.ref_name }} | |
GIT_COMMIT=${{ github.sha }} | |
GIT_DIRTY=0 | |
tags: fogapod/pink:latest | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |