Create deploy.yml

This commit is contained in:
Víctor Martínez 2024-01-21 22:29:55 +01:00 committed by GitHub
commit c43519c109
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

35
.github/workflows/deploy.yml vendored Normal file
View file

@ -0,0 +1,35 @@
name: Publish Docker image
on:
push:
branches: [ "main" ]
# Publish semver tags as releases.
tags: [ 'v*.*.*' ]
jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Log in to Docker Hub
uses: docker/login-action@latest
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@latest
with:
images: jasterv/my-website
- name: Build and push Docker image
uses: docker/build-push-action@latest
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}