Skip to content

use docker action

use docker action #385

Workflow file for this run

name: CI
on:
pull_request:
branches:
- "*"
push:
branches:
- main
jobs:
lint:
env:
UV_CACHE_DIR: /tmp/.uv-cache
runs-on: ubuntu-latest
steps:
- name: Restore uv cache
uses: actions/cache@v4
with:
path: /tmp/.uv-cache
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
restore-keys: |
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
uv-${{ runner.os }}
- 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') }}
- uses: actions/checkout@v4
- name: Set up uv
run: curl -LsSf https://astral.sh/uv/0.3.5/install.sh | sh
- name: Set up Python
run: uv python install
- name: install dependencies
run: uv sync
- name: pre-commit
run: uv run pre-commit run --all-files
- name: Minimize uv cache
run: uv cache prune --ci
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