2021-12-02 03:17:10 +08:00
|
|
|
name: NoneBot2 Publish Bot
|
2020-11-20 00:30:46 +08:00
|
|
|
|
|
|
|
on:
|
|
|
|
issues:
|
2020-11-20 16:39:52 +08:00
|
|
|
types: [opened, reopened, edited]
|
2022-03-25 18:24:35 +08:00
|
|
|
pull_request_target:
|
2020-11-20 00:30:46 +08:00
|
|
|
types: [closed]
|
2022-12-30 11:30:47 +08:00
|
|
|
issue_comment:
|
|
|
|
types: [created]
|
2020-11-20 00:30:46 +08:00
|
|
|
|
2023-01-04 12:48:10 +08:00
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.event.issue.number || github.run_id }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
2020-11-20 00:30:46 +08:00
|
|
|
jobs:
|
2022-12-30 11:30:47 +08:00
|
|
|
plugin_test:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
name: nonebot2 plugin test
|
2023-01-04 12:48:10 +08:00
|
|
|
if: github.event_name != 'issue_comment' || !github.event.issue.pull_request
|
2022-12-30 11:30:47 +08:00
|
|
|
permissions:
|
|
|
|
issues: read
|
|
|
|
outputs:
|
|
|
|
result: ${{ steps.plugin-test.outputs.RESULT }}
|
|
|
|
output: ${{ steps.plugin-test.outputs.OUTPUT }}
|
|
|
|
steps:
|
|
|
|
- name: Install Poetry
|
2023-01-04 12:48:10 +08:00
|
|
|
if: ${{ !startsWith(github.event_name, 'pull_request') }}
|
2022-12-30 11:30:47 +08:00
|
|
|
run: pipx install poetry
|
2023-04-04 09:48:31 +08:00
|
|
|
|
2022-12-30 11:30:47 +08:00
|
|
|
- name: Setup Python
|
|
|
|
uses: actions/setup-python@v4
|
|
|
|
with:
|
|
|
|
python-version: "3.10"
|
2023-04-04 09:48:31 +08:00
|
|
|
|
2022-12-30 11:30:47 +08:00
|
|
|
- name: Test Plugin
|
|
|
|
id: plugin-test
|
|
|
|
run: |
|
2023-04-04 09:48:31 +08:00
|
|
|
curl -sSL https://github.com/nonebot/nonebot2-publish-bot/releases/latest/download/plugin_test.py | python -
|
2021-09-15 17:16:15 +08:00
|
|
|
publish_bot:
|
2020-11-20 00:30:46 +08:00
|
|
|
runs-on: ubuntu-latest
|
2021-09-15 17:16:15 +08:00
|
|
|
name: nonebot2 publish bot
|
2022-12-30 11:30:47 +08:00
|
|
|
needs: plugin_test
|
2020-11-20 00:30:46 +08:00
|
|
|
steps:
|
2023-04-04 09:48:31 +08:00
|
|
|
- name: Generate token
|
|
|
|
id: generate-token
|
|
|
|
uses: tibdex/github-app-token@v1
|
|
|
|
with:
|
|
|
|
app_id: ${{ secrets.APP_ID }}
|
|
|
|
private_key: ${{ secrets.APP_KEY }}
|
|
|
|
|
2022-12-30 11:30:47 +08:00
|
|
|
- name: Checkout Code
|
2022-03-02 13:46:22 +08:00
|
|
|
uses: actions/checkout@v3
|
2022-01-20 13:35:58 +08:00
|
|
|
with:
|
2023-04-04 09:48:31 +08:00
|
|
|
token: ${{ steps.generate-token.outputs.token }}
|
|
|
|
|
2021-09-15 17:16:15 +08:00
|
|
|
- name: NoneBot2 Publish Bot
|
2023-02-10 10:18:38 +08:00
|
|
|
uses: docker://ghcr.io/nonebot/nonebot2-publish-bot:latest
|
2020-11-20 00:30:46 +08:00
|
|
|
with:
|
2023-04-04 09:48:31 +08:00
|
|
|
token: ${{ steps.generate-token.outputs.token }}
|
2022-01-04 20:23:21 +08:00
|
|
|
config: >
|
|
|
|
{
|
|
|
|
"base": "master",
|
|
|
|
"plugin_path": "website/static/plugins.json",
|
|
|
|
"bot_path": "website/static/bots.json",
|
|
|
|
"adapter_path": "website/static/adapters.json"
|
|
|
|
}
|
2022-12-30 11:30:47 +08:00
|
|
|
env:
|
|
|
|
PLUGIN_TEST_RESULT: ${{ needs.plugin_test.outputs.result }}
|
|
|
|
PLUGIN_TEST_OUTPUT: ${{ needs.plugin_test.outputs.output }}
|