Let's start from the beginning. You want to express the problem as solving for a function $G(x,y)$ that satisfies, for $x \in [0,\pi]$
$$\frac{d}{dx^2} G(x,x') + \frac{1}{4} G(x,x') = \delta(x-x') $$
where $\delta(x-x') = 0 \, \forall \, x \ne x'$ and $\int_0^{\pi} dx' \: \delta(x-x') = 1 $. The solution you seek, $y(x)$, satisfies the boundary conditions $y(0) = y(\pi) = 0$, and may be expressed in terms of $g$ as
$$ y(x) = \int_0^{\pi} dx' \: G(x,x') \sin{2 x'} $$
To find $G$, we assume $x \ne x'$ and write down the general solution to the homogeneous equation:
$$G(x,x') = A \cos{\frac{x}{2}} + B \sin{\frac{x}{2}} $$
The boundary conditions on the solution may be expressed in terms of the relation of $x$ to $x'$. For example, the condition on $y(0)$ translates into a condition for $G(x,x') \, \forall \, x < x'$; that is, $G(0,x') = A = 0$ when $x < x'$. Similarly, the condition $y(\pi) = 0 \implies G(\pi,x') = B = 0$ when $x > x'$. We may then write
$$G(x,x') = \displaystyle \begin{cases} B \sin{\frac{x}{2}} & x < x' \\ A \cos{\frac{x}{2}} & x > x' \end{cases}$$
(This is where I think you went off the rails.) To find $A$ and $B$, we impose 2 conditions. The first is that $G(x,x')$ be continuous when $x=x'$. This leads to the relationship $A = B \tan{\frac{x}{2}}$. The second is that the derivative of $G(x,x')$ with respect to $x$ is discontinuous at $x=x'$ and satisfies
$$\lim_{\epsilon \rightarrow 0} \left [ \frac{\partial}{\partial x} G(x'+\epsilon,x') - \frac{\partial}{\partial x} G(x'-\epsilon,x') \right ] = 1$$
This relationship may be seen from integration of the differential equation defining $G$ above. Plugging in the above expression for $G(x,x')$, we get a second relation for $A$ and $B$: $A \sin{\frac{x'}{2}} + B \cos{\frac{x'}{2}} = -2$. We may solve for $A$ and $B$ and find that $A = -2 \sin{\frac{x'}{2}}$ and $B = -2 \cos{\frac{x'}{2}}$. (A little manipulation of trig identiies is needed to get this.) We may now write
$$G(x,x') = \displaystyle \begin{cases} -2 \cos{\frac{x'}{2}} \sin{\frac{x}{2}} & x < x' \\ -2 \sin{\frac{x'}{2}} \cos{\frac{x}{2}} & x > x' \end{cases}$$
We are now ready to compute the solution $y(x)$ as written above. Because of the different functional forms for $G$ about $x=x'$, we need to split the integral defining $y$ into two pieces:
$$y(x) = -2 \cos{\frac{x}{2}} \int_0^x dx' \: \sin{\frac{x'}{2}} \sin{2 x'} -2 \sin{\frac{x}{2}} \int_0^x dx' \: \cos{\frac{x'}{2}} \sin{2 x'}$$
The evaluation of these integrals is made possible through the trigonometric addition formulas $\cos{(a-b)} - \cos{(a+b)} = 2 \sin{a} \sin{b}$ and $\sin{(a+b)} + \sin{(a-b)} = 2 \sin{a} \cos{b}$. It does get a little messy, but you may verify that the solution you seek,
$$y(x) = - \frac{4}{15} \sin{2 x} $$
is the result of the evaluation of the above integrals.