How to run an action on a separate Os?

I’m trying to build a C# documentation for docfx but because I need to use msbuild the generation fails on ubuntu-latest so I need to use windows-* but I have a small problem where some containers are not supported on windows images.

Is there a way to run a step on a separate image while keeping the same files modified by the first images?

As an example:

- steps:
     - name: Windows only action
       run: echo "This file is created with windows" > file.txt
     - name: Linux only action
       run: echo "This line is added by ubuntu" >> file.txt

You’ll have to use separate jobs to use different OS’. So you could build the documentation in a job that runs on a Windows runner, store that as an artifact, and then have a separate job that retrieves that artifact (see Passing data between jobs in a workflow) and runs the containers on a Linux runner.