inexorgame / vulkan-renderer

A new 3D game engine for Linux and Windows using C++20 and Vulkan API 1.3, in very early but ongoing development
https://inexor.org
MIT License
756 stars 33 forks source link

Fix automatic generation of releases in GitHub actions #531

Closed IAmNotHanni closed 1 year ago

IAmNotHanni commented 1 year ago

Describe The Bug

https://github.com/inexorgame/vulkan-renderer/blob/main/.github/workflows/release.yml

Since I renamed the files, the release script is broken. Sorry I didn't think about that.

Steps To Reproduce

  1. Merge a pull request and wait for the GitHub workflow to complete

Expected Behavior

A release is created if a pull request is merged

Affected Code

The GitHub action

Operating System

None

Application Version

3b916441c38a58d4421de8f09a5470940a90a346

Additional Context

None

Relevant Log Output

None
IAmNotHanni commented 1 year ago
- name: Download artifacts
  uses: actions/github-script@v6
  with:
    script: |
      let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
          owner: context.repo.owner,
          repo: context.repo.repo,
          run_id: context.payload.workflow_run.id,
      });
      let matchArtifacts = allArtifacts.data.artifacts.filter((artifact) => {
        console.log(artifact.name);
        console.log(artifact.name.startsWith("release_"));
        return artifact.name.startsWith("release_");
      });
      let fs = require('fs');
      for (const artifact of matchArtifacts) {
        console.log(artifact);
        let download = await github.rest.actions.downloadArtifact({
          owner: context.repo.owner,
          repo: context.repo.repo,
          artifact_id: artifact.id,
          archive_format: 'zip',
        });
        fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/`+artifact.name+`.zip`, Buffer.from(download.data));
      }
IAmNotHanni commented 1 year ago

This is what the filenames look like atm:

grafik

IceflowRE commented 1 year ago

You also removed the condition if: ${{ github.event.workflow_run.conclusion == 'success' }}

IAmNotHanni commented 1 year ago

How should we name the builds which are generated by the CI? Because having "release" in the name should mean that it's build with release configuration. Also, we should write "Debug" and "Release" with small letters in the file name.

IAmNotHanni commented 1 year ago

What about:

operatingsystem_buildtype_compiler_x64?

linux_debug_clang_x64 linux_release_clang_x64 linux_debug_gcc_x64 linux_release_gcc_x64 windows_debug_msvc_x64 windows_release_msvc_x64 windows_debug_msvc_x64 windows_release_msvc_x64

But how would the GitHub action be able to find them if they don't start with "release" ?

IAmNotHanni commented 1 year ago

Maybe let the final builds (only the executable and config/assets/..) start with latest?

latest_linux_debug_clang_x64 latest_linux_release_clang_x64 latest_linux_debug_gcc_x64 latest_linux_release_gcc_x64 latest_windows_debug_msvc_x64 latest_windows_release_msvc_x64 latest_windows_debug_msvc_x64 latest_windows_release_msvc_x64

IceflowRE commented 1 year ago

Maybe let the final builds (only the executable and config/assets/..) start with latest?

latest_linux_debug_clang_x64 latest_linux_release_clang_x64 latest_linux_debug_gcc_x64 latest_linux_release_gcc_x64 latest_windows_debug_msvc_x64 latest_windows_release_msvc_x64 latest_windows_debug_msvc_x64 latest_windows_release_msvc_x64

huh? The uploaded stuff should already contain all required things. We should only upload the release versions. Maybe revert the naming to? buildtype_os_arch_compiler

IAmNotHanni commented 1 year ago

I don't understand: Isn't the GitHub action is picking the files which start with "release_" ?

- name: Download artifacts
  uses: actions/github-script@v6
  with:
    script: |
      let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
          owner: context.repo.owner,
          repo: context.repo.repo,
          run_id: context.payload.workflow_run.id,
      });
      let matchArtifacts = allArtifacts.data.artifacts.filter((artifact) => {
        console.log(artifact.name);
        console.log(artifact.name.startsWith("release_"));
        return artifact.name.startsWith("release_");
      });
      let fs = require('fs');
      for (const artifact of matchArtifacts) {
        console.log(artifact);
        let download = await github.rest.actions.downloadArtifact({
          owner: context.repo.owner,
          repo: context.repo.repo,
          artifact_id: artifact.id,
          archive_format: 'zip',
        });
        fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/`+artifact.name+`.zip`, Buffer.from(download.data));
      }
IAmNotHanni commented 1 year ago

Pull request #534 did not fix the issue.

IAmNotHanni commented 1 year ago

It is still broken after #535. By the way this is still wrong:

console.log(artifact.name.startsWith("release_"));