Skip to content

Commit 1707a5e

Browse files
committed
docs: add detailed guide for Unity package release actions
1 parent 15bce4e commit 1707a5e

File tree

8 files changed

+100
-0
lines changed

8 files changed

+100
-0
lines changed

Docs/bot-setting.jpg

366 KB
Loading

Docs/pull_request.jpg

348 KB
Loading

Docs/pull_request2.jpg

413 KB
Loading

Docs/release-note.jpg

261 KB
Loading

Docs/release_manually.jpg

521 KB
Loading

Docs/release_manually2.jpg

367 KB
Loading

Docs/settings_action.jpg

762 KB
Loading

README.md

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,102 @@
11
# Unity-GitHubActions
22
GitHub Actions for Unity
3+
4+
## What does this action do?
5+
6+
Automate Unity Package Releases Using GitHub Actions
7+
8+
**This action automates the following tasks:**
9+
- Updates the version in the [Package manifest](https://docs.unity3d.com/2022.3/Documentation/Manual/upm-manifestPkg.html)
10+
- Generates a release
11+
- Creates tags
12+
13+
### Release Notes
14+
15+
By starting commit messages with keywords like `feat` or `fix`, they will be automatically included in the release notes.
16+
17+
![](Docs/release-note.jpg)
18+
19+
### When branch or tag protection is enabled
20+
21+
If branch or tag protection is enabled, a permission error will occur by default. To bypass this, you can configure GitHub Apps to allow bypassing those protection rules.
22+
23+
- Create a [GitHub App](https://docs.github.com/en/apps/creating-github-apps/about-creating-github-apps/about-creating-github-apps)
24+
- Set `BOT_APP_ID` and `BOT_PRIVATE_KEY` in the repository's Secrets
25+
- Update the protection rules to allow the GitHub App to bypass them
26+
27+
![](Docs/bot-setting.jpg)
28+
29+
## Required Configuration
30+
31+
Enable the **Read and write permissions** setting under `Settings > Actions > General > Workflow permissions`.
32+
33+
![](Docs/settings_action.jpg)
34+
35+
## Manual Release
36+
37+
Navigate to the Actions tab and trigger the manual release by selecting `Run workflow`.
38+
39+
![](Docs/release_manually.jpg)
40+
41+
| Option | Description | Default | Example |
42+
|-----------------------|--------------|---------|----------|
43+
| tag | Git tag you want to create | | 1.0.0 |
44+
| clean-branch | Delete the branch? All branches except the default branch will be deleted. | false | |
45+
| fast-forward | Allow fast-forward merge | false | |
46+
| include-default-branch | Include the default branch in the workflow behavior | false | |
47+
| dry-run | Simulate the merge without committing or pushing changes | false | |
48+
| draft-release | `true` for Draft release, `false` for Non-draft release | false | |
49+
50+
### Steps to Release Manually
51+
52+
1. Create a branch (e.g., `release`)
53+
2. Prepare the release in this branch
54+
3. Trigger the manual release via `Run workflow`
55+
56+
![](Docs/release_manually2.jpg)
57+
58+
### Setup Guide
59+
60+
1. Copy the code from [.github/workflows/build-release_merge.yaml](https://github.com/IShix-g/Unity-GitHubActions/blob/main/.github/workflows/build-release_merge.yaml) and create a YAML file in your project’s Actions folder.
61+
2. Update the `file-path` in `update-packagejson` to fit your project structure.
62+
3. If branch protection rules are not used, remove any references to `secrets.BOT_APP_ID` and `secrets.BOT_PRIVATE_KEY`.
63+
4. If permission errors occur while running, configure [permissions](https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/controlling-permissions-for-github_token).
64+
65+
---
66+
67+
## Release via Pull Request
68+
69+
Create a pull request from a prepared branch to the default branch with the **release title as the tag name**. Once the pull request is merged, the release will be created automatically.
70+
71+
![](Docs/pull_request.jpg)
72+
73+
After merging, the release will be created automatically.
74+
75+
![](Docs/pull_request2.jpg)
76+
77+
### Conditions for Release Creation
78+
79+
A release will be triggered when the following conditions are met:
80+
- The pull request title contains a version number (e.g., `1.0.0`)
81+
- The base branch is the [default branch](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-branches-in-your-repository/changing-the-default-branch)
82+
83+
### Steps to Release via Pull Request
84+
85+
1. Create a branch (e.g., `release`)
86+
2. Prepare the release in this branch
87+
3. Create a pull request to merge this branch into the default branch. Use the version number as the pull request title.
88+
4. Merge the pull request.
89+
5. The release will be generated automatically.
90+
91+
### Setup Guide
92+
93+
1. Copy the code from [.github/workflows/build-release_pull-request.yaml](https://github.com/IShix-g/Unity-GitHubActions/blob/main/.github/workflows/build-release_pull-request.yaml) and create a YAML file in your project’s Actions folder.
94+
2. Update the `file-path` in `update-packagejson` to match your project’s file structure.
95+
3. If branch protection rules are not used, remove any references to `secrets.BOT_APP_ID` and `secrets.BOT_PRIVATE_KEY`.
96+
4. If permission errors occur while running, configure [permissions](https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/controlling-permissions-for-github_token).
97+
98+
---
99+
100+
## Recommendation
101+
102+
Even when using the pull request release method, it is advisable to configure the manual release option as a fallback mechanism. Otherwise, creating new pull requests will be the only way to create releases.

0 commit comments

Comments
 (0)