From 835d8edf975e3b55a8c92519ee8e9f57fd841596 Mon Sep 17 00:00:00 2001 From: DVKunion <2622100059@qq.com> Date: Fri, 31 Mar 2023 14:20:09 +0800 Subject: [PATCH] feat: + add windows hosts + change example with workflow_dispatch mode + (doc): update README.md --- .github/workflows/example.yml | 16 ++++-- README.md | 58 +++++++++++++++++---- README_EN.md | 96 +++++++++++++++++++++++++++++++++++ action.yml | 20 +++++++- 4 files changed, 176 insertions(+), 14 deletions(-) create mode 100644 README_EN.md diff --git a/.github/workflows/example.yml b/.github/workflows/example.yml index db8d5e3..4958a5f 100644 --- a/.github/workflows/example.yml +++ b/.github/workflows/example.yml @@ -1,6 +1,14 @@ # entry name: example -on: [ push, pull_request ] +on: + workflow_dispatch: + inputs: + token: + description: 'chaitin rivers token' + required: true + type: + description: 'your host type' + required: true jobs: runner: @@ -8,6 +16,8 @@ jobs: steps: - uses: actions/checkout@v3 - name: collie - uses: dvkunion/collie_tricker@main + if: ${{ inputs.token != '' && inputs.type != '' }} + uses: dvkunion/CollieTrickster@main with: - token: ${{ secrets.token }} # your token + token: ${{ inputs.token }} + host_type: ${{ inputs.type }} diff --git a/README.md b/README.md index bbaa215..33aedd8 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,38 @@ -# Collie-Trickster +

Collie-Trickster

-通过 GitHub Action 白嫖国外主机。 +

通过 GitHub Action 白嫖国外主机。[狗头]

-## 使用方式 +

中文文档 | English

+ +

Collie-Trickster 简介

+ +Collie-Trickster 基于 牧云主机助手 (Collie) 实现的Github Action。主要用于更便捷的使用和Debug Github Action。 + +## 🧑‍🤝‍🧑 友情提示 + +**关于风险** + +> 其实大家都知道所谓 "白嫖国外主机" 不过是个噱头 -_- +> +> 首先持续的时常只有 6小时,当然你也可以自己进行一些自动化开发来保持一个持久化的状态,但是不鼓励这样使用,毕竟官方的action说明中提出了明令禁止的用法。 +> +> 其次,该工具的目的在于开启`github action`调试的方案。 +> 用过`gitlab-ci`的人可能会知道,`debug`模式可以直接进入到ci环境中的终端进行人工`debug`,在一些复杂的ci运行出现错误时十分有效。 +> 因此,`Collie-Trickster` 提供给你了一种方案,让你能够获取到一个可调式的环境,方便进行调试。 +> +> 说到底,和大家开了个玩笑,`Collie-Trickster`的目的从一开始就是一个debug工具的定位。 +> 任何使用`Collie-Trickster`作恶而导致可能面临的风险,包括github封号的情况,`Collie-Trickster`不承担任何责任。 + +**一些其他的声音** +
See More + +
+ +## 🎮 快速开始 + +### 基础使用 + +
CLICK ME 1. 注册百川-使用牧云主机管理助手 @@ -16,6 +46,9 @@ ![](https://cdn.dvkunion.cn/tricker/09d9e9ee0809482faf54b491e42ae7d8.png) +为了方便,可以选择长期使用的token + +![](https://cdn.dvkunion.cn/tricker/c63a06e23805430781cc42fc485d8f79.png) 4. 在github创建一个空的仓库,clone到本地,并创建`.github/workflows/workflow.yml`文件,写入一下参考内容: @@ -34,7 +67,11 @@ jobs: token: xxxxxx # your token, It will be safer to use ${{ secrets.token }}, see [https://docs.github.com/actions/security-guides/encrypted-secrets] ``` -5. git push 上去代码,触发action。 +5. 推送代码到仓库,触发action。 + +```shell +git push +``` 6. 返回百川界面,已获取到主机。 @@ -42,10 +79,13 @@ jobs: 7. 后续使用时可以通过手动触发action的方式。 -## 一些更有趣的玩法 +
+ +### 高级模版: 通过http触发器自动触发 + +
CLICK ME +
-一些更便捷的方式,如果需求的人多会逐步加入到demo。 +## 🎈 更有趣的玩法 -+ 可以使用github action 的`on:workflow_dispatch`,通过http请求触发ci,来实现主机上线控制。 -+ 也可以将token参数作为input。在每次http请求时动态带上token, 方便操作。 -+ \ No newline at end of file +如果你有什么更加有趣的想法或建议,欢迎提交 Issue/Pr \ No newline at end of file diff --git a/README_EN.md b/README_EN.md new file mode 100644 index 0000000..b800cfe --- /dev/null +++ b/README_EN.md @@ -0,0 +1,96 @@ +

Collie-Trickster

+ +

Get An Free foreign hosts through GitHub Action [doge] + +

Chinese Documents | English

+ +

Collie-Trickster introduction

+ +Collie Trickster is based on the MuYun Virtual Machine Assistant (Collie), Github Action implemented. Mainly used for more convenient use and Debug Github Action. + +## 🧑‍🤝‍🧑 Friendly reminder + +**About Risk** + +> Actually, everyone knows that the so-called "Get An Free foreign hosts" is just a gimmick -_- +> +> First of all, the duration is usually only 6 hours. Of course, you can also conduct some automated development yourself to maintain a persistent state, but this use is not encouraged. After all, the official action description proposes explicitly prohibited usage. +> +> Secondly, the purpose of this tool is to enable the `github action` debugging scheme. +> People who have used `gittab ci` may know that the `debug` mode can directly access terminals in the ci environment for manual `debug`, which is very effective when some complex ci operations encounter errors. +> Therefore, `Collie Trickster` provides you with a solution that allows you to obtain an adjustable environment for debugging. +> +> After all, I made a joke with everyone that the purpose of `Collie Trickster` was to locate a debugging tool from the beginning. +> +> `Collie Trickster` does not assume any responsibility for any possible risks that may arise from using `Collie Strickster` to commit crimes, including the Github seal.". + +**Some other sounds** + +
See More +
+ + +## 🎮 Quick Start + +### Basic usage + +
CLICK ME + +1. Register for Rivers Platform - Use MuYun Virtual Machine Management Assistant + +![](https://cdn.dvkunion.cn/tricker/46fd1775808c4411b8c2f1225641289f.png) + +2. Click Bind Host + +![](https://cdn.dvkunion.cn/tricker/b61fa3cb6f0f4069b60c99a48be599aa.png) + +3. Obtain token + +![](https://cdn.dvkunion.cn/tricker/09d9e9ee0809482faf54b491e42ae7d8.png) + +For convenience, you can choose a token for long-term use + +![](https://cdn.dvkunion.cn/tricker/c63a06e23805430781cc42fc485d8f79.png) + +4. Create an empty project at Github, clone it locally, and create a `.github/workflows/workflow.yml` file. Write + the following reference content: + +```yml +name: example +on: [ push, pull_request ] + +jobs: + runner: + runs-on: ubuntu-latest # select your host system like:ubuntu:20.04 + steps: + - uses: actions/checkout@v3 + - name: collie + uses: dvkunion/collie_tricker@main + with: + token: xxxxxx # your token, It will be safer to use ${{ secrets.token }}, see [https://docs.github.com/actions/security-guides/encrypted-secrets] +``` + +5. Push the code to trigger the action. + +```shell +git push + +``` + +6. Return to the Rivers interface and obtain the host. + +![](https://cdn.dvkunion.cn/tricker/4f8e7c5ea2234135b6f57de12a115f30.png) + +7. During subsequent use, you can manually trigger an action. + +
+ +### Advanced template: Automatically triggered through http triggers + +
CLICK ME + +
+ +## 🎈 More fun ways to play + +If you have any more interesting ideas or suggestions, Welcome to submit an Issue/Pr. \ No newline at end of file diff --git a/action.yml b/action.yml index 7fcddfc..4e7c396 100644 --- a/action.yml +++ b/action.yml @@ -8,10 +8,26 @@ inputs: token: description: 'your collie token' default: '' + host_type: + description: 'your host type like: linux/windows' + default: 'linux' + time: + description: 'continue time, min' + default: '360' + runs: using: 'composite' steps: - - run: curl -kfsSL 'http://collie-agent.chaitin.com:1443/api/v1/host/install_script?os_type=linux' | sudo bash -s -- --token=${{ inputs.token }} + - name: regist-linux-host + if: ${{ inputs.host_type != 'linux'}} + run: curl -kfsSL 'http://collie-agent.chaitin.com:1443/api/v1/host/install_script?os_type=linux' | sudo bash -s -- --token=${{ inputs.token }} shell: bash - - run: sleep 360m + - name: regist-windows-host + if: ${{ inputs.host_type != 'windows'}} + run: | + Invoke-WebRequest -Uri 'http://collie-agent.chaitin.com:1443/api/v1/lighter/installer?arch=x86_64&os_type=windows&token=${{ inputs.token }}' -OutFile "install.exe" + Start-Process install.exe -Wait + shell: powershell + - name: kepp + run: sleep ${{ inputs.time }}m shell: bash \ No newline at end of file