{"id":20139415,"url":"https://github.com/mackysoft/unity-githubactions-exportpackage-example","last_synced_at":"2025-04-09T18:22:26.092Z","repository":{"id":111399681,"uuid":"356670225","full_name":"mackysoft/Unity-GitHubActions-ExportPackage-Example","owner":"mackysoft","description":"A example project of exporting a package using Unity and GitHub Actions.","archived":false,"fork":false,"pushed_at":"2021-04-11T15:48:26.000Z","size":33,"stargazers_count":11,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-23T20:22:32.634Z","etag":null,"topics":["ci","example","export","github-actions","package","tutorial","unity"],"latest_commit_sha":null,"homepage":"https://qiita.com/makihiro_dev/items/4e2d83ad0d268b43f4a4","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mackysoft.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"mackysoft"}},"created_at":"2021-04-10T19:02:12.000Z","updated_at":"2024-01-05T13:16:26.000Z","dependencies_parsed_at":"2023-05-18T15:00:58.476Z","dependency_job_id":null,"html_url":"https://github.com/mackysoft/Unity-GitHubActions-ExportPackage-Example","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mackysoft%2FUnity-GitHubActions-ExportPackage-Example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mackysoft%2FUnity-GitHubActions-ExportPackage-Example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mackysoft%2FUnity-GitHubActions-ExportPackage-Example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mackysoft%2FUnity-GitHubActions-ExportPackage-Example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mackysoft","download_url":"https://codeload.github.com/mackysoft/Unity-GitHubActions-ExportPackage-Example/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248085719,"owners_count":21045200,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ci","example","export","github-actions","package","tutorial","unity"],"created_at":"2024-11-13T21:45:15.098Z","updated_at":"2025-04-09T18:22:26.072Z","avatar_url":"https://github.com/mackysoft.png","language":"C#","readme":"﻿# Unity \u0026 GitHubActions ExportPackage Example\n\nA example project of exporting a package using Unity and GitHub Actions.\n\n\u003e Qiita: [UnityとGitHubActionsを使って自動でunitypackageをエクスポートする](https://qiita.com/makihiro_dev/items/4e2d83ad0d268b43f4a4)\n\n\n## 🔰 Tutorial\n\n### 1. Write C# to export the package.\n\nCreate `UnityPackageExporter.cs` under the `Editor` folder in the project repository, and write the following.\n(The package name and other constants should match your project)\n\n```cs:UnityPackageExporter.cs\nusing System.IO;\nusing UnityEditor;\n\nnamespace ExportPackageExample.Editor {\n\tpublic static class UnityPackageExporter {\n\n\t\t// The name of the unitypackage to output.\n\t\tconst string k_PackageName = \"ExportPackageExample\";\n\n\t\t// The path to the package under the `Assets/` folder.\n\t\tconst string k_PackagePath = \"ExportPackageExample\";\n\n\t\t// Path to export to.\n\t\tconst string k_ExportPath = \"Build\";\n\n\t\tpublic static void Export () {\n\t\t\tExportPackage($\"{k_ExportPath}/{k_PackageName}.unitypackage\");\n\t\t}\n\n\t\tpublic static string ExportPackage (string exportPath) {\n\t\t\t// Ensure export path.\n\t\t\tvar dir = new FileInfo(exportPath).Directory;\n\t\t\tif (dir != null \u0026\u0026 !dir.Exists) {\n\t\t\t\tdir.Create();\n\t\t\t}\n\n\t\t\t// Export\n\t\t\tAssetDatabase.ExportPackage(\n\t\t\t\t$\"Assets/{k_PackagePath}\",\n\t\t\t\texportPath,\n\t\t\t\tExportPackageOptions.Recurse\n\t\t\t);\n\n\t\t\treturn Path.GetFullPath(exportPath);\n\t\t}\n\n\t}\n}\n```\n\nThis is a fairly concise code, so if you want to customize the package in more detail, please refer to the official documentation.\nhttps://docs.unity3d.com/ScriptReference/AssetDatabase.ExportPackage.html\n\n\n### 2. Acquire ULF\n\nAcquire the ULF file to activate your Unity license.\nUse the following tool to acquire the ULF file.\n\nhttps://github.com/mackysoft/Unity-ManualActivation\n\n\n### 3. Register ULF to Secrets\n\n1. Select the `Settings \u003e Secrets` menu in the project repository.\n2. Click the `New repository secret` button.\n3. Enter \"UNITY_LICENSE\" in Name and copy and paste the contents of the ULF file in Value.\n4. Click the `Add secret` button.\n\nYou can now treat the contents of the ULF file as an environment variable while keeping its contents private.\n\n### 4. Write YAML to export unitypackage on GitHub Actions.\n\nCreate a `package.yaml` under the repository `.github/workflows/` and write the following.\n\n```yaml:package.yaml\nname: Export Package\n\non:\n  pull_request: {}\n  push: { branches: [main] }\n\nenv:\n  UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}\n\njobs:\n  build:\n    name: Build UnityPackage\n    runs-on: ubuntu-latest\n    steps:\n      # Checkout\n      - name: Checkout repository\n        uses: actions/checkout@v2\n        with:\n          lfs: true\n\n      # Cache\n      - name: Cache\n        uses: actions/cache@v2\n        with:\n          path: Library\n          key: Library\n          restore-keys: Library-\n\n      # Build\n      - name: Build .unitypackage\n        uses: game-ci/unity-builder@v2\n        with:\n          unityVersion: 2020.3.1f1\n          buildMethod: ExportPackageExample.Editor.UnityPackageExporter.Export # Path to the export method containing the namespace.\n\n      # Upload\n      - name: Upload .unitypackage\n        uses: actions/upload-artifact@v2\n        with:\n          name: Unity Package\n          path: Build\n```\n\n\n### 5. Exporting\n\nThe workflow for exporting unitypackage will run by making a Push and Pull Request to the repository.\n\nIf you see a tick mark as shown below, you have succeeded. The exported unitypackage can be acquired from Artifacts in the upper right corner.\n\n![ExportResult](https://user-images.githubusercontent.com/13536348/114300084-80995a00-9af9-11eb-9113-afd9ecf6f7d9.jpg)\n\n\n#  📔 Author Info\n\nHiroya Aramaki is a indie game developer in Japan.\n\n- Blog: [https://mackysoft.net/blog](https://mackysoft.net/blog)\n- Twitter: [https://twitter.com/makihiro_dev](https://twitter.com/makihiro_dev)\n\n\n#  📜 License\n\nThis repository is under the MIT License.","funding_links":["https://github.com/sponsors/mackysoft"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmackysoft%2Funity-githubactions-exportpackage-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmackysoft%2Funity-githubactions-exportpackage-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmackysoft%2Funity-githubactions-exportpackage-example/lists"}