From 355fb8e9152deed25882f4ffa3449778d36d0066 Mon Sep 17 00:00:00 2001 From: Reza Behzadan Date: Fri, 3 Jan 2025 10:00:13 -0500 Subject: [PATCH] Add github actions (for build and push the docker image) --- .github/workflows/build-and-push.yaml | 32 +++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/build-and-push.yaml diff --git a/.github/workflows/build-and-push.yaml b/.github/workflows/build-and-push.yaml new file mode 100644 index 0000000..83010a1 --- /dev/null +++ b/.github/workflows/build-and-push.yaml @@ -0,0 +1,32 @@ +name: Build and Publish Docker Image + +on: + release: + types: [published] + +env: + IMAGE_NAME: rbehzadan/wireguard-3proxy + IMAGE_TAG: ${{ github.event.release.tag_name }} + +jobs: + build-and-publish: + runs-on: ubuntu-latest + + steps: + - name: Checkout the code + uses: actions/checkout@v4 + + - name: Build Docker image + run: docker build -t ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} . + + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_PASSWORD }} + + - name: Push Docker image to Docker Hub + run: | + docker push ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} + docker tag ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} ${{ env.IMAGE_NAME }}:latest + docker push ${{ env.IMAGE_NAME }}:latest