Skip to content

Commit 46e569a

Browse files
committed
use docker action
1 parent 0697bd5 commit 46e569a

File tree

1 file changed

+24
-19
lines changed

1 file changed

+24
-19
lines changed

.github/workflows/main.yaml

+24-19
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ on:
77
branches:
88
- main
99

10-
env:
11-
IMAGE_NAME: fogapod/pink
12-
1310
jobs:
1411
lint:
1512
env:
@@ -33,11 +30,11 @@ jobs:
3330
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
3431
- uses: actions/checkout@v4
3532
- name: Set up uv
36-
run: curl -LsSf https://astral.sh/uv/0.3.3/install.sh | sh
33+
run: curl -LsSf https://astral.sh/uv/0.3.5/install.sh | sh
3734
- name: Set up Python
3835
run: uv python install
39-
- name: install mypy
40-
run: uv sync --dev
36+
- name: install dependencies
37+
run: uv sync
4138
- name: pre-commit
4239
run: uv run pre-commit run --all-files
4340
- name: Minimize uv cache
@@ -51,17 +48,25 @@ jobs:
5148
- uses: actions/checkout@v4
5249
with:
5350
submodules: true
54-
- name: Build image
55-
run: |
56-
docker pull $IMAGE_NAME
57-
docker build -t $IMAGE_NAME:latest . \
58-
--build-arg GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD) \
59-
--build-arg GIT_COMMIT=$(git rev-parse HEAD) \
60-
--build-arg GIT_DIRTY=$(git status --porcelain=v1 2>/dev/null | wc -l)
61-
- name: Log in into Docker Hub
62-
run: |
63-
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
6451

65-
- name: Push image to registry
66-
run: |
67-
docker push $IMAGE_NAME
52+
- name: Set up Docker Buildx
53+
uses: docker/setup-buildx-action@v3
54+
55+
- name: Login to Docker Hub
56+
uses: docker/login-action@v3
57+
with:
58+
username: ${{ secrets.DOCKER_USERNAME }}
59+
password: ${{ secrets.DOCKER_PASSWORD }}
60+
61+
- name: Build and push
62+
uses: docker/build-push-action@v6
63+
with:
64+
push: true
65+
# GIT_DIRTY=$(git status --porcelain=v1 2>/dev/null | wc -l)
66+
build-args: |
67+
GIT_BRANCH=${{ github.ref_name }}
68+
GIT_COMMIT=${{ github.sha }}
69+
GIT_DIRTY=0
70+
tags: fogapod/pink:latest
71+
cache-from: type=gha
72+
cache-to: type=gha,mode=max

0 commit comments

Comments
 (0)