From fc718208a33ba8fc5984c8dc4a5386032ee4cc5a Mon Sep 17 00:00:00 2001 From: Igor Date: Mon, 11 Nov 2024 17:38:58 +0100 Subject: [PATCH] Add GitHub Actions workflow for automated build and deployment to Docker Hub --- .github/workflows/build-and-deploy.yml | 35 ++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/build-and-deploy.yml diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml new file mode 100644 index 0000000..69880fc --- /dev/null +++ b/.github/workflows/build-and-deploy.yml @@ -0,0 +1,35 @@ +name: Build and Deploy + +on: + push: + branches: + - main + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Docker Hub Description + uses: peter-evans/dockerhub-description@v4 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + repository: ${{ secrets.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }} + short-description: ${{ github.event.repository.description }} + + - name: Log in to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push Docker image + uses: docker/build-push-action@v2 + with: + context: . + push: true + tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }}:latest