wireguard-3proxy-docker/.github/workflows/build-and-push.yaml

33 lines
881 B
YAML

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