Finally I have found the issue. In the github actions .yaml I have defined the output branch to 'gh-pages'. But in the pages settings I have still referenced the 'main' branch, thats why it showed always 404 file not found. So I have changed that to 'gh-pages' and now it works.