#
自动化发布¥Automate Releases
如果你的项目遵循语义版本控制,那么自动化发布所需的步骤可能是个好主意。下面的秘诀会更改项目版本,将更改提交到 git 并创建新的 GitHub 版本。
¥If your project follows a semantic versioning, it may be a good idea to automatize the steps needed to do a release. The recipe below bumps the project version, commits the changes to git and creates a new GitHub release.
要发布 GitHub 版本,你需要 创建个人访问令牌 并将其添加到你的项目中。但是,我们不想提交它,因此我们将使用 dotenv
从 git-ignored .env
文件加载它:
¥For publishing a GitHub release you'll need to create a personal access token and add it to your project. However, we don't want to commit it, so we'll use dotenv
to load it from a git-ignored .env
file:
不要忘记将 .env
添加到 .gitignore
中。
¥Don't forget to add .env
to your .gitignore
.
接下来,安装此秘诀的所有必需依赖:
¥Next, install all the necessary dependencies for this recipe:
根据你的环境、设置和偏好,你的发布工作流程可能如下所示:
¥Based on your environment, setup and preferences, your release workflow might look something like this: