Skip to content

Commit

Permalink
use docker action
Browse files Browse the repository at this point in the history
  • Loading branch information
Fogapod committed Aug 27, 2024
1 parent 0697bd5 commit d9f2f70
Showing 1 changed file with 24 additions and 19 deletions.
43 changes: 24 additions & 19 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ on:
branches:
- main

env:
IMAGE_NAME: fogapod/pink

jobs:
lint:
env:
Expand All @@ -33,11 +30,11 @@ jobs:
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.3/install.sh | sh
run: curl -LsSf https://astral.sh/uv/0.3.5/install.sh | sh
- name: Set up Python
run: uv python install
- name: install mypy
run: uv sync --dev
- name: install dependencies
run: uv sync
- name: pre-commit
run: uv run pre-commit run --all-files
- name: Minimize uv cache
Expand All @@ -51,17 +48,25 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: true
- name: Build image
run: |
docker pull $IMAGE_NAME
docker build -t $IMAGE_NAME:latest . \
--build-arg GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD) \
--build-arg GIT_COMMIT=$(git rev-parse HEAD) \
--build-arg GIT_DIRTY=$(git status --porcelain=v1 2>/dev/null | wc -l)
- name: Log in into Docker Hub
run: |
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin

- name: Push image to registry
run: |
docker push $IMAGE_NAME
- 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_TOKEN }}

- 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

0 comments on commit d9f2f70

Please sign in to comment.