Skip to content

Commit

Permalink
Update Project.swift and GitHub Actions workflow to set build number …
Browse files Browse the repository at this point in the history
…dynamically

- Added MARKETING_VERSION and CURRENT_PROJECT_VERSION placeholders in Project.swift for versioning.
- Implemented a step in the GitHub Actions workflow to generate a build number based on the current timestamp and replace the placeholder in Project.swift.
- These changes streamline the versioning process and enhance the CI/CD pipeline for automated builds.
  • Loading branch information
ygsgdbd committed Dec 22, 2024
1 parent 82e3f47 commit e4cfea7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 8 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ jobs:
run: |
brew install tuist
- name: Set Build Number
run: |
# 生成基于时间戳的构建号(格式:YYYYMMDDHHmm)
BUILD_NUMBER=$(date "+%Y%m%d%H%M")
# 替换 Project.swift 中的占位符,使用 # 作为分隔符
sed -i '' "s#@BUILD_NUMBER@#$BUILD_NUMBER#g" Project.swift
echo "Build number set to: $BUILD_NUMBER"
- name: Generate Xcode Project
run: |
tuist generate --no-open
Expand Down
4 changes: 3 additions & 1 deletion Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ let project = Project(
base: [
"SWIFT_VERSION": "5.9",
"DEVELOPMENT_LANGUAGE": "zh-Hans",
"SWIFT_EMIT_LOC_STRINGS": "YES"
"SWIFT_EMIT_LOC_STRINGS": "YES",
"MARKETING_VERSION": "0.1.0",
"CURRENT_PROJECT_VERSION": "@BUILD_NUMBER@"
],
configurations: [
.debug(name: "Debug"),
Expand Down

0 comments on commit e4cfea7

Please sign in to comment.