From 5e808205ff3580f958450a2e0f0358a939a31f63 Mon Sep 17 00:00:00 2001 From: nomadics9 <60583633+nomadics9@users.noreply.github.com> Date: Sun, 15 Dec 2024 04:05:05 +0300 Subject: [PATCH] Create main.yml --- .github/workflows/main.yml | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..75743f2 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,36 @@ +name: Build and Push Docker Image + +on: + push: + paths: + - version.txt # Trigger workflow only when version.txt changes + +jobs: + build-and-push: + runs-on: ubuntu-latest + + steps: + # Step 1: Check out the repository + - name: Checkout code + uses: actions/checkout@v4 + + # Step 2: Set up Docker Buildx + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + # Step 3: Log in to Docker Hub + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + # Step 4: Build and push the Docker image + - name: Build and Push Image + uses: docker/build-push-action@v6 + with: + context: ./alaskarfin # Path to the build context + file: ./alaskarfin # Path to the Dockerfile + push: true # Push the image to Docker Hub + tags: | + nomadics/alaskarfin:latest