-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
342 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
github: zeroonet | ||
open_collective: zonplayer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
### Check List | ||
|
||
Thanks for considering to open an issue. Before you submit your issue, please confirm these boxes are checked. | ||
|
||
- [ ] I have read the [wiki page](https://github.com/ZeroOnet/ZonPlayer/wiki) and [cheat sheet](https://github.com/ZeroOnet/ZonPlayer/wiki/Cheat-Sheet), but there is no information I need. | ||
- [ ] I have searched in [existing issues](https://github.com/ZeroOnet/ZonPlayer/issues?utf8=✓&q=is%3Aissue), but did not find a same one. | ||
- [ ] I want to report a problem instead of asking a question. It'd better to use [ZonPlayer tag in Stack Overflow](http://stackoverflow.com/questions/tagged/ZonPlayer) to ask a question. | ||
|
||
### Issue Description | ||
|
||
#### What | ||
|
||
[Tell us about the issue] | ||
|
||
#### Reproduce | ||
|
||
[The steps to reproduce this issue. What is the url you were trying to load, where did you put your code, etc.] | ||
|
||
#### Other Comment | ||
|
||
[Add anything else here] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: build | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
run-test: | ||
runs-on: macos-12 | ||
strategy: | ||
matrix: | ||
destination: ["iOS Simulator,name=iPhone 14"] | ||
swift-version: [5.0] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: 3.1.2 | ||
bundler-cache: true | ||
- name: Run tests | ||
env: | ||
DESTINATION: platform=${{ matrix.destination }} | ||
SWIFT_VERSION: ${{ matrix.swift-version }} | ||
run: bundle exec fastlane test_ci |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -281,6 +281,7 @@ GEM | |
xcpretty (~> 0.2, >= 0.0.7) | ||
|
||
PLATFORMS | ||
x86_64-darwin-19 | ||
x86_64-darwin-21 | ||
|
||
DEPENDENCIES | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
fastlane_version "2.217.0" | ||
|
||
default_platform :ios | ||
|
||
platform :ios do | ||
desc "Runs all the tests" | ||
lane :tests do | ||
test(destination: "platform=iOS Simulator,name=iPhone 14", swift_version: "5.0") | ||
end | ||
|
||
lane :test_ci do | ||
if ENV["DESTINATION"].include? "watchOS" then | ||
build(destination: ENV["DESTINATION"], swift_version: ENV["SWIFT_VERSION"]) | ||
else | ||
test(destination: ENV["DESTINATION"], swift_version: ENV["SWIFT_VERSION"]) | ||
end | ||
end | ||
|
||
lane :test do |options| | ||
scan( | ||
scheme: "ZonPlayer", | ||
clean: true, | ||
xcargs: "SWIFT_VERSION=#{options[:swift_version]}", | ||
destination: options[:destination] | ||
) | ||
end | ||
|
||
lane :build do |options| | ||
gym( | ||
workspace: "ZonPlayer.xcworkspace", | ||
configuration: "Debug", | ||
scheme: "ZonPlayer", | ||
xcargs: "SWIFT_VERSION=#{options[:swift_version]}", | ||
destination: options[:destination] | ||
) | ||
end | ||
|
||
desc "Lint" | ||
lane :lint do | ||
pod_lib_lint | ||
spm | ||
end | ||
|
||
desc "Release new version" | ||
lane :release do |options| | ||
target_version = options[:version] | ||
raise "The version is missed. Use `fastlane release version:{version_number}`.`" if target_version.nil? | ||
|
||
ensure_git_branch | ||
ensure_git_status_clean | ||
|
||
skip_tests = options[:skip_tests] | ||
tests unless skip_tests | ||
|
||
lint | ||
|
||
sync_build_number_to_git | ||
increment_version_number(version_number: target_version) | ||
version_bump_podspec(path: "ZonPlayer.podspec", version_number: target_version) | ||
|
||
log = extract_current_change_log(version: target_version) | ||
release_log = update_change_log(log: log) | ||
|
||
git_commit_all(message: "Bump version to #{target_version}") | ||
|
||
Actions.sh("git tag -s #{target_version} -m ''") | ||
|
||
push_to_git_remote | ||
|
||
set_github_release( | ||
repository_name: "ZeroOnet/ZonPlayer", | ||
api_token: ENV['GITHUB_TOKEN'], | ||
name: release_log[:title], | ||
tag_name: target_version, | ||
description: release_log[:text], | ||
upload_assets: ["build/ZonPlayer-#{target_version}.zip"] | ||
) | ||
|
||
pod_push | ||
end | ||
|
||
after_all do |lane| | ||
|
||
end | ||
|
||
error do |lane, exception| | ||
|
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
module Fastlane | ||
module Actions | ||
class ExtractCurrentChangeLogAction < Action | ||
require 'yaml' | ||
def self.run(params) | ||
yaml = File.read(params[:file]) | ||
data = YAML.load(yaml) | ||
version = data["version"] | ||
raise "The version should match in the input file".red unless (version and version == params[:version]) | ||
|
||
title = "#{version}" | ||
title = title + " - #{data["name"]}" if (data["name"] and not data["name"].empty?) | ||
|
||
return {:title => title, :version => version, :add => data["add"], :fix => data["fix"], :remove => data["remove"]} | ||
end | ||
|
||
##################################################### | ||
# @!group Documentation | ||
##################################################### | ||
|
||
def self.description | ||
"Extract change log information for a specified version." | ||
end | ||
|
||
def self.details | ||
"This action will check input version and change log. If everything goes well, the change log info will be returned." | ||
end | ||
|
||
def self.available_options | ||
[ | ||
FastlaneCore::ConfigItem.new(key: :version, | ||
env_name: "KF_EXTRACT_CURRENT_CHANGE_LOG_VERSION", | ||
description: "The target version which is needed to be extract", | ||
verify_block: proc do |value| | ||
raise "No version number is given, pass using `version: 'version_number'`".red unless (value and not value.empty?) | ||
end), | ||
FastlaneCore::ConfigItem.new(key: :file, | ||
env_name: "KF_EXTRACT_CURRENT_CHANGE_LOG_PRECHANGE_FILE", | ||
description: "Create a development certificate instead of a distribution one", | ||
default_value: "pre-change.yml") | ||
] | ||
end | ||
|
||
def self.return_value | ||
"An object contains change log infomation. {version: }" | ||
end | ||
|
||
def self.is_supported?(platform) | ||
true | ||
end | ||
|
||
def self.authors | ||
["ZeroOnet"] | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
module Fastlane | ||
module Actions | ||
class GitCommitAllAction < Action | ||
def self.run(params) | ||
Action.sh "git add -A" | ||
Actions.sh "git commit -am \"#{params[:message]}\"" | ||
end | ||
|
||
##################################################### | ||
# @!group Documentation | ||
##################################################### | ||
|
||
def self.description | ||
"Commit all unsaved changes to git." | ||
end | ||
|
||
def self.available_options | ||
[ | ||
FastlaneCore::ConfigItem.new(key: :message, | ||
env_name: "FL_GIT_COMMIT_ALL", | ||
description: "The git message for the commit", | ||
is_string: true) | ||
] | ||
end | ||
|
||
def self.authors | ||
["ZeroOnet"] | ||
end | ||
|
||
def self.is_supported?(platform) | ||
true | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
module Fastlane | ||
module Actions | ||
module SharedValues | ||
KF_BUILD_NUMBER = :BUILD_NUMBER | ||
end | ||
class SyncBuildNumberToGitAction < Action | ||
def self.is_git? | ||
Actions.sh 'git rev-parse HEAD' | ||
return true | ||
rescue | ||
return false | ||
end | ||
|
||
def self.run(params) | ||
if is_git? | ||
command = 'git rev-list HEAD --count' | ||
else | ||
raise "Not in a git repository." | ||
end | ||
build_number = (Actions.sh command).strip | ||
Fastlane::Actions::IncrementBuildNumberAction.run(build_number: build_number) | ||
Actions.lane_context[SharedValues::KF_BUILD_NUMBER] = build_number | ||
end | ||
|
||
def self.output | ||
[ | ||
['KF_BUILD_NUMBER', 'The new build number'] | ||
] | ||
end | ||
##################################################### | ||
# @!group Documentation | ||
##################################################### | ||
|
||
def self.description | ||
"Set the build version of your project to the same number of your total git commit count" | ||
end | ||
|
||
def self.authors | ||
["ZeroOnet"] | ||
end | ||
|
||
def self.is_supported?(platform) | ||
[:ios].include? platform | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
module Fastlane | ||
module Actions | ||
class UpdateChangeLogAction < Action | ||
def self.run(params) | ||
log = params[:log] | ||
raise "Invalid log object".red unless !log[:title].empty? and !log[:version].empty? | ||
|
||
readme = File.read(params[:changelogfile]) | ||
log_text = "## [#{log[:title]}](https://github.com/ZeroOnet/ZonPlayer/releases/tag/#{log[:version]}) (#{Time.now.strftime("%Y-%m-%d")})\n\n" | ||
|
||
des = "" | ||
add = log[:add].map { |i| "* #{i}" }.join("\n") unless log[:add].nil? | ||
des = des + "#### Add\n#{add}\n\n" unless add.nil? or add.empty? | ||
|
||
fix = log[:fix].map { |i| "* #{i}" }.join("\n") unless log[:fix].nil? | ||
des = des + "#### Fix\n#{fix}\n\n" unless fix.nil? or fix.empty? | ||
|
||
remove = log[:remove].map { |i| "* #{i}" }.join("\n") unless log[:remove].nil? | ||
des = des + "#### Remove\n#{remove}\n\n" unless remove.nil? or remove.empty? | ||
|
||
log_text = log_text + des | ||
|
||
File.open(params[:changelogfile], 'w') { |file| file.write(readme.sub("-----", "-----\n\n#{log_text}---")) } | ||
|
||
return {:title => log[:title], :text => des} | ||
end | ||
|
||
##################################################### | ||
# @!group Documentation | ||
##################################################### | ||
|
||
def self.description | ||
"Update the change log file with the content of log" | ||
end | ||
|
||
def self.details | ||
"Generally speaking, the log is return value of extract_current_change_log action" | ||
end | ||
|
||
def self.available_options | ||
[ | ||
FastlaneCore::ConfigItem.new(key: :log, | ||
env_name: "ZP_UPDATE_CHANGE_LOG_LOG", | ||
description: "Change log extracted by pre change log file", | ||
is_string: false | ||
), | ||
FastlaneCore::ConfigItem.new(key: :changelogfile, | ||
env_name: "ZP_UPDATE_CHANGE_LOG_CHANGE_LOG_FILE", | ||
description: "The change log file, if not set, CHANGELOG.md will be used", | ||
default_value: "CHANGELOG.md") | ||
] | ||
end | ||
|
||
def self.authors | ||
["ZeroOnet"] | ||
end | ||
|
||
def self.is_supported?(platform) | ||
true | ||
end | ||
end | ||
end | ||
end |