Repository: conda-forge/conda-smithy

Issue:
GitHub actions upload artifact
The `azure` provider provides the option to upload the built package as an artifact. I don't see the same option for the `github_actions` provider. Can artifact upload be enabled for `github_actions`?

The Upload-Artifact action: https://github.com/marketplace/actions/upload-a-build-artifact

<!--
Thanks for reporting your issue.
Please fill out the sections below.
-->

- [X] I read [the conda-forge documentation](https://conda-forge.org/docs/user/introduction.html#how-can-i-install-packages-from-conda-forge) and could not find the solution for my problem there.

Issue:

<br/>
Environment (<code>conda list</code>):
<details>

```
$ conda list

```
</details>

<br/>

<details>

```
$ conda info

active environment : base
    active env location : C:\tools\miniconda3
            shell level : 1
       user config file : C:\Users\user\.condarc
 populated config files : C:\Users\user\.condarc
          conda version : 4.10.1
    conda-build version : 3.21.4
         python version : 3.8.8.final.0
       virtual packages : __cuda=11.0=0
                          __win=0=0
                          __archspec=1=x86_64
       base environment : C:\tools\miniconda3  (writable)
      conda av data dir : C:\tools\miniconda3\etc\conda
  conda av metadata url : https://repo.anaconda.com/pkgs/main
           channel URLs : https://conda.anaconda.org/robostack/win-64
                          https://conda.anaconda.org/robostack/noarch
                          https://conda.anaconda.org/conda-forge/win-64
                          https://conda.anaconda.org/conda-forge/noarch
                          https://repo.anaconda.com/pkgs/main/win-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/win-64
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://repo.anaconda.com/pkgs/msys2/win-64
                          https://repo.anaconda.com/pkgs/msys2/noarch
          package cache : C:\tools\miniconda3\pkgs
                          C:\Users\user\.conda\pkgs
                          C:\Users\user\AppData\Local\conda\conda\pkgs
       envs directories : C:\tools\miniconda3\envs
                          C:\Users\user\.conda\envs
                          C:\Users\user\AppData\Local\conda\conda\envs
               platform : win-64
             user-agent : conda/4.10.1 requests/2.25.1 CPython/3.8.8 Windows/10 Windows/10.0.19041
          administrator : True
             netrc file : None
           offline mode : False

```
</details>



Discussion:
It's certainly a possibility, and something that I too am interested in. I might get around to implementing this in the near future, but I won't be mad if somebody beats me to it!

Resolving patch:
diff --git a/conda_smithy/configure_feedstock.py b/conda_smithy/configure_feedstock.py
--- a/conda_smithy/configure_feedstock.py
+++ b/conda_smithy/configure_feedstock.py
@@ -1188,7 +1188,11 @@ def _github_actions_specific_setup(
         "osx": [
             ".scripts/run_osx_build.sh",
         ],
+        "win": [],
     }
+    if forge_config["github_actions"]["store_build_artifacts"]:
+        for tmpls in platform_templates.values():
+            tmpls.append(".scripts/create_conda_build_artifacts.sh")
     template_files = platform_templates.get(platform, [])
 
     _render_template_exe_files(
@@ -1259,6 +1263,16 @@ def _azure_specific_setup(jinja_env, forge_config, forge_dir, platform):
         ],
         "win": [".azure-pipelines/azure-pipelines-win.yml"],
     }
+    if forge_config["azure"]["store_build_artifacts"]:
+        platform_templates["linux"].append(
+            ".scripts/create_conda_build_artifacts.sh"
+        )
+        platform_templates["osx"].append(
+            ".scripts/create_conda_build_artifacts.sh"
+        )
+        platform_templates["win"].append(
+            ".scripts/create_conda_build_artifacts.bat"
+        )
     template_files = platform_templates.get(platform, [])
 
     azure_settings = deepcopy(forge_config["azure"][f"settings_{platform}"])
@@ -1294,7 +1308,7 @@ def _azure_specific_setup(jinja_env, forge_config, forge_dir, platform):
         if "docker_image" in data["config"] and platform == "linux":
             config_rendered["DOCKER_IMAGE"] = data["config"]["docker_image"][-1]
         if forge_config["azure"]["store_build_artifacts"]:
-            config_rendered["SHORT_CONFIG_NAME"] = data["short_config_name"]
+            config_rendered["SHORT_CONFIG"] = data["short_config_name"]
         azure_settings["strategy"]["matrix"][data["config_name"]] = config_rendered
         # fmt: on
 
@@ -1663,6 +1677,9 @@ def _load_forge_config(forge_dir, exclusive_config_file, forge_yml=None):
         },
         "github_actions": {
             "self_hosted": False,
+            # Toggle creating artifacts for conda build_artifacts dir
+            "store_build_artifacts": False,
+            "artifact_retention_days": 14,
         },
         "recipe_dir": "recipe",
         "skip_render": [],
@@ -1924,6 +1941,8 @@ def get_common_scripts(forge_dir):
         "run_docker_build.sh",
         "build_steps.sh",
         "run_osx_build.sh",
+        "create_conda_build_artifacts.bat",
+        "create_conda_build_artifacts.sh",
     ]:
         yield os.path.join(forge_dir, ".scripts", old_file)
 
@@ -1940,6 +1959,8 @@ def clear_scripts(forge_dir):
             "run_docker_build.sh",
             "build_steps.sh",
             "run_osx_build.sh",
+            "create_conda_build_artifacts.bat",
+            "create_conda_build_artifacts.sh",
         ]:
             remove_file(os.path.join(forge_dir, folder, old_file))
 


Test patch: