I will map it out and you can fill in the details. We are given
$$y'= Ay + g = \begin{pmatrix}1 & -1 \\ 2 & -1\end{pmatrix}y+\begin{pmatrix}\dfrac{1}{\cos x} \\ 0\end{pmatrix}$$
Using eigenvalues / eigenvectors (or other approaches), we find the homogeneous solution
$$Y_h(x) = c_1\begin{pmatrix}\sin x + \cos x \\ 2\sin x\end{pmatrix} + c_2 \begin{pmatrix}-\sin x \\ \cos x - \sin x\end{pmatrix}$$
For Variation of Parameters (there are other approaches too), we will follow Example 2
$$Y = \begin{pmatrix}\sin x + \cos x & -\sin x \\ 2\sin x & \cos x - \sin x \end{pmatrix} \implies Y^{-1} =
\begin{pmatrix}
\cos x-\sin x & \sin x \\-2 \sin x & \sin x + \cos x
\end{pmatrix}$$
We now form
$$Y^{-1} g = \begin{pmatrix}
\cos x -\sin x & \sin x \\-2 \sin x & \sin x + \cos x
\end{pmatrix} \begin{pmatrix}\dfrac{1}{\cos x} \\ 0\end{pmatrix} =
\begin{pmatrix}
\sec x ~(\cos x - \sin x) \\
-2 \tan x
\end{pmatrix}
$$
Next we integrate the previous result
$$\displaystyle \int Y^{-1}g ~dx = \begin{pmatrix}
x+\ln (\cos x) \\
2 \ln (\cos x) \\
\end{pmatrix}$$
We can now write the particular solution $Y_p(x) = Y \displaystyle \int Y^{-1}g~ dx$
$$Y_p(x) = \begin{pmatrix} \cos x (x+\ln (\cos x))+\sin x (x-\ln (\cos x)) \\2 (x \sin x +\cos x \ln (\cos x))\end{pmatrix}$$
Now write
$$Y(x) = Y_h(x) + Y_p(x)$$