remove_tag.rb 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. module Fastlane
  2. module Actions
  3. module SharedValues
  4. REMOVE_TAG_CUSTOM_VALUE = :REMOVE_TAG_CUSTOM_VALUE
  5. end
  6. class RemoveTagAction < Action
  7. def self.run(params)
  8. tagName = params[:tag]
  9. isRemoveLocalTag = params[:rL]
  10. isRemoveRemoteTag = params[:rR]
  11. #1.先定义一个数组,用来存储所有需要执行的命令
  12. cmds = []
  13. #2.往数组里面添加相应的命令
  14. #删除本地标签
  15. #git tag -d 标签名称
  16. if isRemoveLocalTag
  17. cmds << "git tag -d #{tagName} "
  18. end
  19. #删除远程标签
  20. #git push origin :标签名称
  21. if isRemoveRemoteTag
  22. cmds << " git push origin :#{tagName}"
  23. end
  24. #3.执行数组里面的所有命令
  25. result = Actions.sh(cmds.join('&'));
  26. return result
  27. end
  28. def self.description
  29. "删除标签"
  30. end
  31. def self.details
  32. # Optional:
  33. # this is your chance to provide a more detailed description of this action
  34. "我们可以使用这个action来删除本地或者远程标签"
  35. end
  36. def self.available_options
  37. # Define all options your action supports.
  38. # Below a few examples
  39. [
  40. FastlaneCore::ConfigItem.new(key: :tag,
  41. description: "需要删除的标签名称",
  42. optional:false,
  43. is_string:true,
  44. ),
  45. FastlaneCore::ConfigItem.new(key: :rL,
  46. description: "是否需要删除本地标签",
  47. optional:true,
  48. is_string:false,
  49. default_value:true),
  50. FastlaneCore::ConfigItem.new(key: :rR,
  51. description: "是否需要删除远程标签",
  52. optional:true,
  53. is_string:false,
  54. default_value:true)
  55. ]
  56. end
  57. def self.output
  58. end
  59. def self.return_value
  60. nil
  61. end
  62. def self.authors
  63. # So no one will ever forget your contribution to fastlane :) You are awesome btw!
  64. ["yyqxiaoyin"]
  65. end
  66. def self.is_supported?(platform)
  67. # you can do things like
  68. #
  69. # true
  70. #
  71. # platform == :ios
  72. #
  73. # [:ios, :mac].include?(platform)
  74. #
  75. platform == :ios
  76. end
  77. end
  78. end
  79. end