123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- module Fastlane
- module Actions
- module SharedValues
- REMOVE_TAG_CUSTOM_VALUE = :REMOVE_TAG_CUSTOM_VALUE
- end
- class RemoveTagAction < Action
- def self.run(params)
-
- tagName = params[:tag]
- isRemoveLocalTag = params[:rL]
- isRemoveRemoteTag = params[:rR]
-
- #1.先定义一个数组,用来存储所有需要执行的命令
-
- cmds = []
-
- #2.往数组里面添加相应的命令
-
-
-
- #删除本地标签
- #git tag -d 标签名称
-
- if isRemoveLocalTag
- cmds << "git tag -d #{tagName} "
- end
-
-
- #删除远程标签
- #git push origin :标签名称
-
-
- if isRemoveRemoteTag
-
- cmds << " git push origin :#{tagName}"
-
- end
-
- #3.执行数组里面的所有命令
-
- result = Actions.sh(cmds.join('&'));
-
- return result
-
- end
- def self.description
- "删除标签"
- end
- def self.details
- # Optional:
- # this is your chance to provide a more detailed description of this action
- "我们可以使用这个action来删除本地或者远程标签"
- end
- def self.available_options
- # Define all options your action supports.
-
- # Below a few examples
- [
- FastlaneCore::ConfigItem.new(key: :tag,
- description: "需要删除的标签名称",
- optional:false,
- is_string:true,
- ),
- FastlaneCore::ConfigItem.new(key: :rL,
- description: "是否需要删除本地标签",
- optional:true,
- is_string:false,
- default_value:true),
- FastlaneCore::ConfigItem.new(key: :rR,
- description: "是否需要删除远程标签",
- optional:true,
- is_string:false,
- default_value:true)
- ]
- end
- def self.output
- end
- def self.return_value
- nil
- end
- def self.authors
- # So no one will ever forget your contribution to fastlane :) You are awesome btw!
- ["yyqxiaoyin"]
- end
- def self.is_supported?(platform)
- # you can do things like
- #
- # true
- #
- # platform == :ios
- #
- # [:ios, :mac].include?(platform)
- #
- platform == :ios
- end
- end
- end
- end
|