Skip to content

Commit

Permalink
Automatic docker image building on pushed tags
Browse files Browse the repository at this point in the history
  • Loading branch information
fkantelberg committed Nov 7, 2023
1 parent 32fad9f commit 9e2483f
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
matrix:
python-version: ['3.10', '3.11']
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/setup-python@v4
with:
Expand Down
39 changes: 35 additions & 4 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
name: publish

on:
release:
types: [published]
push:
tags:
- 'v*'

jobs:
deploy:
deploy pypi:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/setup-python@v4
with:
Expand All @@ -34,3 +35,33 @@ jobs:
python setup.py bdist_wheel
twine check dist/*
twine upload dist/*
deploy docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: fkantelberg/mail-devel

- name: Build and push Docker image
uses: docker/build-push-action@v5
env:
PYTHON_VERSION: ${{ vars.PYTHON_VERSION }}
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

0 comments on commit 9e2483f

Please sign in to comment.