diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..7c0dbcd --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,35 @@ +name: Build and Publish Docker Image + +on: + push: + branches: + - main + tags: + - 'v*' # Trigger on tags that start with 'v' + +jobs: + build-and-publish: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Build Docker image + run: | + docker build -t sami/brudi-rclone:${{ github.ref }} . + docker tag sami/brudi-rclone:${{ github.ref }} sami/brudi-rclone:latest + + - name: Log in to Docker Hub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Push image to Docker Hub + run: | + docker push sami/brudi-rclone:${{ github.ref }} + docker push sami/brudi-rclone:latest