Skip to content

Commit 396f585

Browse files
SAnCherepanSAnCherepan
authored andcommitted
Added CI for docker build and push
1 parent 221dc2c commit 396f585

1 file changed

Lines changed: 36 additions & 2 deletions

File tree

.github/workflows/release.yml

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ jobs:
1313
runs-on: ubuntu-latest
1414

1515
steps:
16-
- uses: actions/checkout@v3
16+
- name: Checkout
17+
uses: actions/checkout@v3
1718

1819
- name: Set up Python
1920
uses: actions/setup-python@v3
@@ -35,4 +36,37 @@ jobs:
3536
with:
3637
user: __token__
3738
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
38-
repository_url: https://test.pypi.org/legacy/
39+
repository_url: https://test.pypi.org/legacy/
40+
41+
deploy-docker:
42+
runs-on: ubuntu-latest
43+
if: github.ref_type == 'tag'
44+
45+
needs: deploy-pypi
46+
steps:
47+
- name: Checkout
48+
uses: actions/checkout@v3
49+
50+
- name: Login to Docker Hub
51+
uses: docker/login-action@v2
52+
with:
53+
username: ${{ secrets.DOCKER_USER }}
54+
password: ${{ secrets.DOCKER_TOKEN }}
55+
56+
- name: Extract metadata (tags, labels) for Docker
57+
id: meta
58+
uses: docker/metadata-action@v4
59+
with:
60+
images: sancherepan/repo-reader
61+
flavor: latest=true
62+
tags: type=semver,pattern={{version}}
63+
64+
65+
- name: Build and push
66+
uses: docker/build-push-action@v3
67+
with:
68+
context: .
69+
file: docker/Dockerfile
70+
push: true
71+
tags: ${{ steps.meta.outputs.tags }}
72+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)