Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[platform][config] Release process improvements & config tweaks #65

Merged
merged 11 commits into from
Feb 17, 2019
38 changes: 35 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ jobs:
type: string
steps:
- checkout
- run:
command: make update_build_number
name: Update build number
- run:
command: make package
name: Build package
Expand All @@ -29,16 +26,42 @@ jobs:
root: << parameters.artifacts-path >>
paths:
- .
generate_changelog:
executor: mac
parameters:
changelog-dir:
default: changelog
type: string
changelog-path:
default: changelog.md
type: string
steps:
- checkout
- run: mkdir -p << parameters.changelog-dir >>
- run: make install
- run: FINCH_CONFIG=.finch/release_config.yml finch compare > << parameters.changelog-dir >>/<< parameters.changelog-path >>
- persist_to_workspace:
root: << parameters.changelog-dir >>
paths:
- << parameters.changelog-path >>
publish_release:
executor: go
parameters:
artifacts-path:
default: artifacts
type: string
changelog-dir:
default: changelog
type: string
changelog-path:
default: changelog.md
type: string
steps:
- run: mkdir -p << parameters.artifacts-path >>
- attach_workspace:
at: << parameters.artifacts-path >>
- attach_workspace:
at: << parameters.changelog-path >>
- run:
command: |
go get github.com/tcnksm/ghr
Expand All @@ -48,8 +71,10 @@ jobs:
-r ${CIRCLE_PROJECT_REPONAME} \
-c ${CIRCLE_SHA1} \
-n ${CIRCLE_TAG} \
-b $(cat << parameters.changelog-dir >>/<< parameters.changelog-path >>) \
-delete \
-prerelease \
-draft \
${CIRCLE_TAG} << parameters.artifacts-path >>
name: Publish release to GitHub
swiftlint:
Expand Down Expand Up @@ -123,11 +148,18 @@ workflows:
ignore: /.*/
tags:
only: /.*/
- generate_changelog:
filters:
branches:
ignore: /.*/
tags:
only: /.*/
- publish_release:
requires:
- swiftlint
- test
- build_package
- generate_changelog
filters:
branches:
ignore: /.*/
Expand Down
21 changes: 21 additions & 0 deletions .finch/release_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
format:
format_string: ' - << message >> - << commit_type_hyperlink >>'
section_infos:
- capitalizes_message: true
tags:
- feature
- features
title: Features
- capitalizes_message: true
tags:
- bug fix
- bug
- bugfix
- bug-fix
title: Bug Fixes
git:
repo_base_url: https://github.com/namolnad/finch
resolution_commands:
build_number: /usr/bin/env bash -c 'git -C $PROJECT_DIR rev-list $NEW_VERSION --count'


8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ prefix_install:

publish: test
$(eval NEW_VERSION:=$(filter-out $@, $(MAKECMDGOALS)))
read -p "Warning: This will force create/push a tag for $(NEW_VERSION), are you sure? (y/n) " -n 1 -t 5 -r CONFIRMATION < /dev/tty
if [[ ! $(CONFIRMATION) =~ ^[Yy]$ ]]; then
echo '\nAborted' && exit 1
fi
git checkout master
git checkout -B releases/$(NEW_VERSION)
@NEW_VERSION=$(NEW_VERSION) $(MAKE) update_version
Expand All @@ -89,8 +93,8 @@ publish: test
cat $(BUILD_NUMBER_FILE)
git add -f $(BUILD_NUMBER_FILE)
git commit --amend --no-edit
git tag $(NEW_VERSION)
git push --tags --force
git tag -f $(NEW_VERSION)
git push origin $(NEW_VERSION) --force
git checkout master
@echo 'Reminder: Update version in master if needed.'

Expand Down
3 changes: 0 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ let package = Package(
"pre-push": [
"make lint",
],
"post-checkout": [
"make xcodeproj",
]
],
])
#endif
8 changes: 2 additions & 6 deletions Resources/template.config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,9 @@ format:
- bugfix
title: Bug Fixes
git:
branch_prefix: origin/releases/ ## Defaults to
branch_prefix: origin/releases/ ## Defaults to ""
repo_base_url: https://github.com/org/repo ## Configure to follow your convention
resolution_commands:
build_number:
- /usr/bin/env
- bash
- -c
- git -C $HOME/Code/Finch rev-list --count @
build_number: /usr/bin/env bash -c 'git -C $PROJECT_DIR rev-list $NEW_VERSION --count'


4 changes: 2 additions & 2 deletions Sources/FinchApp/Services/ChangeLogInfoService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ struct ChangeLogInfoService: ChangeLogInfoServiceType {
]) { $1 }

return try Shell(env: environment)
.run(args: args)
.run(args: [args])
.trimmingCharacters(in: .whitespacesAndNewlines)
}

Expand All @@ -78,7 +78,7 @@ struct ChangeLogInfoService: ChangeLogInfoServiceType {
let environment = env.merging(["PROJECT_DIR": app.configuration.projectDir]) { $1 }

let shell = Shell(env: environment, verbose: app.options.verbose)
return try shell.run(args: value)
return try shell.run(args: [value])
}

let git = Git(app: app, env: env)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
//

public struct ResolutionCommandsConfiguration {
public private(set) var buildNumber: [String]?
public private(set) var versions: [String]?
public private(set) var buildNumber: String?
public private(set) var versions: String?
}

extension ResolutionCommandsConfiguration: Codable {
Expand Down Expand Up @@ -40,12 +40,7 @@ extension ResolutionCommandsConfiguration: Mergeable {

extension ResolutionCommandsConfiguration {
static let example: ResolutionCommandsConfiguration = .init(
buildNumber: [
"/usr/bin/env",
"bash",
"-c",
"git -C $PROJECT_DIR rev-list --count @ origin/releases/$NEW_VERSION"
],
buildNumber: "/usr/bin/env bash -c 'git -C $PROJECT_DIR rev-list origin/releases/$NEW_VERSION --count'",
versions: nil
)
}
2 changes: 1 addition & 1 deletion Tests/FinchAppTests/AppRunnerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ final class AppRunnerTests: XCTestCase {
environment: [:],
meta: .mock,
output: outputMock
).run(arguments: ["finch", "compare", "--git-log", defaultInputMock, "--versions", "6.20.0", "5.3.0"])
).run(arguments: ["finch", "compare", "--git-log", defaultInputMock, "--versions", "6.20.0", "5.3.0", "--build-number", "612"])

assertSnapshot(matching: outputMock.outputs, as: .dump)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
▿ 1 element
- "\n# 6.20.0\n\n### Features\n - |tests| fix order snapshots - [PR #1018](/pull/1018) - long_live_the_citadel@rick.com\n - |search| consolidate searchBar cornerRadius to 4, increase autocomplete-v3 term height - [PR #1011](/pull/1011) - elvis1935+still-alive@theking.com\n - |rollbar| update to v1.0.0 final - [PR #1007](/pull/1007) - elvis1935+still-alive@theking.com\n - |push-notificatons| Request for permission after user places an order with 90 day re-prompt - [PR #1024](/pull/1024) - jony.ive@apple.com\n - |platform| background actions - [PR #955](/pull/955) - elvis1935+still-alive@theking.com\n - |express-placement| build error fix - [PR #1025](/pull/1025) - jony.ive@apple.com\n - |express-placement| additional clean-up for analytics and bugs - [PR #1021](/pull/1021) - jony.ive@apple.com\n - |codable| better supported for AnyEncodables - [PR #1022](/pull/1022) - elvis1935+still-alive@theking.com\n - |carthage| move google places to internal carthage - [PR #1008](/pull/1008) - elvis1935+still-alive@theking.com\n - |autocomplete-v3| add analytics - [PR #1030](/pull/1030) - elvis1935+still-alive@theking.com\n - |analytics| Current production express placements are missing subscription_id in express_start.purchase tracking events - [PR #1020](/pull/1020) - jony.ive@apple.com\n - Update all express placements to one screen - [PR #975](/pull/975) - jony.ive@apple.com\n - Syncing express params across checkout modules - [PR #1016](/pull/1016) - long_live_the_citadel@rick.com\n - Order status V2.5 - [PR #988](/pull/988) - elvis1935+still-alive@theking.com\n - Autocomplete V3 - [PR #1004](/pull/1004) - elvis1935+still-alive@theking.com\n\n### Bug Fixes\n - |bug| Don\'t show express placement every cold start - [PR #1019](/pull/1019) - jony.ive@apple.com\n - |bug fix| minor bug fixes for cubs/pbi - [PR #1010](/pull/1010) - elvis1935+still-alive@theking.com\n - |bug fix| fix LossyCodableArray - [PR #1017](/pull/1017) - long_live_the_citadel@rick.com\n"
- "\n# 6.20.0 (612)\n\n### Features\n - |tests| fix order snapshots - [PR #1018](/pull/1018) - long_live_the_citadel@rick.com\n - |search| consolidate searchBar cornerRadius to 4, increase autocomplete-v3 term height - [PR #1011](/pull/1011) - elvis1935+still-alive@theking.com\n - |rollbar| update to v1.0.0 final - [PR #1007](/pull/1007) - elvis1935+still-alive@theking.com\n - |push-notificatons| Request for permission after user places an order with 90 day re-prompt - [PR #1024](/pull/1024) - jony.ive@apple.com\n - |platform| background actions - [PR #955](/pull/955) - elvis1935+still-alive@theking.com\n - |express-placement| build error fix - [PR #1025](/pull/1025) - jony.ive@apple.com\n - |express-placement| additional clean-up for analytics and bugs - [PR #1021](/pull/1021) - jony.ive@apple.com\n - |codable| better supported for AnyEncodables - [PR #1022](/pull/1022) - elvis1935+still-alive@theking.com\n - |carthage| move google places to internal carthage - [PR #1008](/pull/1008) - elvis1935+still-alive@theking.com\n - |autocomplete-v3| add analytics - [PR #1030](/pull/1030) - elvis1935+still-alive@theking.com\n - |analytics| Current production express placements are missing subscription_id in express_start.purchase tracking events - [PR #1020](/pull/1020) - jony.ive@apple.com\n - Update all express placements to one screen - [PR #975](/pull/975) - jony.ive@apple.com\n - Syncing express params across checkout modules - [PR #1016](/pull/1016) - long_live_the_citadel@rick.com\n - Order status V2.5 - [PR #988](/pull/988) - elvis1935+still-alive@theking.com\n - Autocomplete V3 - [PR #1004](/pull/1004) - elvis1935+still-alive@theking.com\n\n### Bug Fixes\n - |bug| Don\'t show express placement every cold start - [PR #1019](/pull/1019) - jony.ive@apple.com\n - |bug fix| minor bug fixes for cubs/pbi - [PR #1010](/pull/1010) - elvis1935+still-alive@theking.com\n - |bug fix| fix LossyCodableArray - [PR #1017](/pull/1017) - long_live_the_citadel@rick.com\n"
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
▿ 1 element
- "contributors:\n contributor_handle_prefix: \'@\'\n contributor_list:\n - emails:\n - esme.squalor@example.com\n - esmeDevAccount@github.com\n handle: GigiGeniveve\n - email: violet.baudelaire@gmail.com\n handle: OlafIsEvil\nformat:\n delimiters:\n input:\n left: \'[\'\n right: \']\'\n output:\n left: \'|\'\n right: \'|\'\n footer: null\n format_string: \' - << tags >> << message >> - << commit_type_hyperlink >> - << contributor_handle\n >>\'\n header: null\n section_infos:\n - format_string: \' - << tags >> << message >> - << commit_type_hyperlink >> - <<\n contributor_handle >>\'\n capitalizes_message: false\n excluded: false\n tags:\n - \'*\'\n title: Features\n - format_string: \' - << tags >> << message >> - << commit_type_hyperlink >> - <<\n contributor_handle >>\'\n capitalizes_message: false\n excluded: false\n tags:\n - bugfix\n - bug fix\n - bug\n title: Bug Fixes\ngit:\n branch_prefix: \n repo_base_url: \nresolution_commands:\n build_number:\n - /usr/bin/env\n - bash\n - -c\n - git -C $PROJECT_DIR rev-list --count @ origin/releases/$NEW_VERSION\n"
- "contributors:\n contributor_handle_prefix: \'@\'\n contributor_list:\n - emails:\n - esme.squalor@example.com\n - esmeDevAccount@github.com\n handle: GigiGeniveve\n - email: violet.baudelaire@gmail.com\n handle: OlafIsEvil\nformat:\n delimiters:\n input:\n left: \'[\'\n right: \']\'\n output:\n left: \'|\'\n right: \'|\'\n footer: null\n format_string: \' - << tags >> << message >> - << commit_type_hyperlink >> - << contributor_handle\n >>\'\n header: null\n section_infos:\n - format_string: \' - << tags >> << message >> - << commit_type_hyperlink >> - <<\n contributor_handle >>\'\n capitalizes_message: false\n excluded: false\n tags:\n - \'*\'\n title: Features\n - format_string: \' - << tags >> << message >> - << commit_type_hyperlink >> - <<\n contributor_handle >>\'\n capitalizes_message: false\n excluded: false\n tags:\n - bugfix\n - bug fix\n - bug\n title: Bug Fixes\ngit:\n branch_prefix: \n repo_base_url: \nresolution_commands:\n build_number: /usr/bin/env bash -c \'git -C $PROJECT_DIR rev-list origin/releases/$NEW_VERSION\n --count\'\n"
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,5 @@
- repoBaseUrl: "https://github.com/citadel-of-ricks/C-137"
- projectDir: "current"
▿ resolutionCommandsConfig: ResolutionCommandsConfiguration
- buildNumber: Optional<Array<String>>.none
- versions: Optional<Array<String>>.none
- buildNumber: Optional<String>.none
- versions: Optional<String>.none
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,5 @@
- repoBaseUrl: "https://github.com/citadel-of-ricks/C-137"
- projectDir: "current"
▿ resolutionCommandsConfig: ResolutionCommandsConfiguration
- buildNumber: Optional<Array<String>>.none
- versions: Optional<Array<String>>.none
- buildNumber: Optional<String>.none
- versions: Optional<String>.none