From f12b71ca5b0b7d9be6b3aa946ea28e58ba5c3050 Mon Sep 17 00:00:00 2001 From: Andy Zhang <37402126+AnzhiZhang@users.noreply.github.com> Date: Fri, 2 Feb 2024 21:14:47 +0000 Subject: [PATCH] =?UTF-8?q?build:=20=F0=9F=91=B7=20upgrade=20release-pleas?= =?UTF-8?q?e-action?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yml | 126 +++++++++--------- .release-please/.release-please-manifest.json | 18 +++ .release-please/release-please-config.json | 45 +++++++ changeFinder.js | 38 ------ plugin_list.json | 18 --- 5 files changed, 128 insertions(+), 117 deletions(-) create mode 100644 .release-please/.release-please-manifest.json create mode 100644 .release-please/release-please-config.json delete mode 100644 changeFinder.js delete mode 100644 plugin_list.json diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7fb59eb..7b772ff 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,96 +5,100 @@ on: - master jobs: - change-finder: - runs-on: ubuntu-latest - name: Change Finder + # change-finder: + # runs-on: ubuntu-latest + # name: Change Finder - outputs: - changed: ${{ steps.find.outputs.changed }} - plugins: ${{ steps.find.outputs.plugins }} + # outputs: + # changed: ${{ steps.find.outputs.changed }} + # plugins: ${{ steps.find.outputs.plugins }} - steps: - - name: Check Out - uses: actions/checkout@v3 - with: - fetch-depth: 0 + # steps: + # - name: Check Out + # uses: actions/checkout@v4 + # with: + # fetch-depth: 0 - - name: Find - id: find - run: | - npm i @actions/core - node changeFinder.js + # - name: Find + # id: find + # run: | + # npm i @actions/core + # node changeFinder.js - release-please-pr: + # release-please-pr: + # runs-on: ubuntu-latest + # name: Release Please PR + # needs: + # - change-finder + # - release-please-release + # strategy: + # fail-fast: false + # matrix: + # plugin: ${{ fromJson(needs.change-finder.outputs.plugins) }} + + # steps: + # - name: Release Please PR + # uses: google-github-actions/release-please-action@v4 + # with: + # release-type: simple + # package-name: ${{ matrix.plugin }} + # path: ${{ matrix.plugin }} + # monorepo-tags: true + # command: release-pr + # pull-request-title-pattern: 'chore${scope}: 🔖 release${component} ${version}' + + release-please: runs-on: ubuntu-latest - name: Release Please PR - needs: - - change-finder - - release-please-release - strategy: - fail-fast: false - matrix: - plugin: ${{ fromJson(needs.change-finder.outputs.plugins) }} + name: Release Please + + outputs: + release_created: ${{ steps.release-please.outputs.release_created }} + paths_released: ${{ steps.release-please.outputs.paths_released }} + tag_name: ${{ steps.release-please.outputs.tag_name }} + all: ${{ steps.release-please.outputs }} steps: - - name: Release Please PR - uses: google-github-actions/release-please-action@v3 + - name: Release Please + uses: google-github-actions/release-please-action@v4 + id: release-please with: - release-type: simple - package-name: ${{ matrix.plugin }} - path: ${{ matrix.plugin }} - monorepo-tags: true - command: release-pr - pull-request-title-pattern: 'chore${scope}: 🔖 release${component} ${version}' - - release-please-release: + config-file: .release-please/release-please-config.json + manifest-file: .release-please/.release-please-manifest.json + + - run: | + echo "${{ steps.release-please.outputs }}" + + build: runs-on: ubuntu-latest - name: Release Please Release - needs: change-finder - if: ${{ needs.change-finder.outputs.changed == 'true' }} - strategy: - fail-fast: false - matrix: - plugin: ${{ fromJson(needs.change-finder.outputs.plugins) }} + name: Build + needs: release-please steps: - - name: Release Please Release - uses: google-github-actions/release-please-action@v3 - id: release_please_release - with: - release-type: simple - package-name: ${{ matrix.plugin }} - path: ${{ matrix.plugin }} - monorepo-tags: true - command: github-release - pull-request-title-pattern: 'chore${scope}: 🔖 release${component} ${version}' + - run: | + echo "${{ needs.release-please.outputs }}" + echo "${{ needs.release-please.outputs.all }}" - name: Check Out - uses: actions/checkout@v3 - if: ${{ steps.release_please_release.outputs[format('{0}--release_created', matrix.plugin)] }} + uses: actions/checkout@v4 - name: Setup Python uses: actions/setup-python@v4 - if: ${{ steps.release_please_release.outputs[format('{0}--release_created', matrix.plugin)] }} with: - python-version: '3.10' + python-version: '3.12' - name: Install Dependencies - if: ${{ steps.release_please_release.outputs[format('{0}--release_created', matrix.plugin)] }} run: | python -m pip install --upgrade pip pip install mcdreforged - name: Pack id: pack - if: ${{ steps.release_please_release.outputs[format('{0}--release_created', matrix.plugin)] }} run: | - python -m mcdreforged pack --ignore-patterns __pycache__ -i ${{ matrix.plugin }} + mcdreforged pack --ignore-patterns __pycache__ -i ${{ matrix.plugin }} echo "name=$(ls *.mcdr)" >> $GITHUB_OUTPUT - name: Upload - if: ${{ steps.release_please_release.outputs[format('{0}--release_created', matrix.plugin)] }} env: GH_TOKEN: ${{ github.token }} run: | - gh release upload ${{ steps.release_please_release.outputs[format('{0}--tag_name', matrix.plugin)] }} ${{ steps.pack.outputs.name }} + gh release upload ${{ needs.release-please.outputs[format('{0}--tag_name', matrix.plugin)] }} ${{ steps.pack.outputs.name }} diff --git a/.release-please/.release-please-manifest.json b/.release-please/.release-please-manifest.json new file mode 100644 index 0000000..bb96e6c --- /dev/null +++ b/.release-please/.release-please-manifest.json @@ -0,0 +1,18 @@ +{ + "src/advanced_calculator": "0.3.1", + "src/bingo": "0.0.3", + "src/bot": "1.1.2", + "src/database_api": "0.1.1", + "src/dict_command_registration": "1.1.0", + "src/fastapi_mcdr": "1.0.0", + "src/gamemode": "1.1.0", + "src/info": "0.2.0", + "src/let_me_click_and_send": "1.0.0", + "src/lowercase_mcdr_command": "1.2.2", + "src/minecraft_command_register": "1.7.3", + "src/more_command_nodes": "1.1.0", + "src/online_player_api": "1.0.0", + "src/qq_api": "1.3.1", + "src/qq_chat": "2.1.0", + "src/uuid_api": "0.1.2" +} diff --git a/.release-please/release-please-config.json b/.release-please/release-please-config.json new file mode 100644 index 0000000..b4b22e0 --- /dev/null +++ b/.release-please/release-please-config.json @@ -0,0 +1,45 @@ +{ + "release-type": "simple", + "pull-request-title-pattern": "chore${scope}: 🔖 release${component} ${version}", + "extra-files": [ + { + "type": "json", + "path": "mcdreforged.plugin.json", + "jsonpath": "$.json" + } + ], + "packages": { + "src/advanced_calculator": { + }, + "src/bingo": { + }, + "src/bot": { + }, + "src/database_api": { + }, + "src/dict_command_registration": { + }, + "src/fastapi_mcdr": { + }, + "src/gamemode": { + }, + "src/info": { + }, + "src/let_me_click_and_send": { + }, + "src/lowercase_mcdr_command": { + }, + "src/minecraft_command_register": { + }, + "src/more_command_nodes": { + }, + "src/online_player_api": { + }, + "src/qq_api": { + }, + "src/qq_chat": { + }, + "src/uuid_api": { + } + } +} diff --git a/changeFinder.js b/changeFinder.js deleted file mode 100644 index cf4768b..0000000 --- a/changeFinder.js +++ /dev/null @@ -1,38 +0,0 @@ -const core = require('@actions/core'); -const execSync = require('child_process').execSync; -const pluginList = require('./plugin_list.json'); -const tagList = execSync('git tag', {encoding: 'utf-8'}).trim().split('\n').reverse(); - -function isAffectReleaseLog(log) { - return log.includes('fix') || log.includes('feat') || log.includes('!') || log.includes('Release-As: '); -} - -let changedList = []; -for (let pluginKey in pluginList) { - let pluginID = pluginList[pluginKey]; - let findTagFlag = false; - for (let tagKey in tagList) { - let tagName = tagList[tagKey]; - if (tagName.startsWith(pluginID)) { - let gitLog = execSync(`git log ${tagName}...HEAD ${pluginID}`, {encoding: 'utf-8'}); - if (isAffectReleaseLog(gitLog)) { - changedList.push(pluginID); - } - findTagFlag = true; - break; - } - } - if (!findTagFlag) { - let gitLog = execSync(`git log ${pluginID}`, {encoding: 'utf-8'}); - if (isAffectReleaseLog(gitLog)) { - changedList.push(pluginID); - } - } -} - -function isAffectReleaseLog(log) { - return log.includes('fix') || log.includes('feat') || log.includes('!') || log.includes('Release-As: '); -} - -core.setOutput('changed', changedList.length > 0); -core.setOutput('plugins', JSON.stringify(changedList)); diff --git a/plugin_list.json b/plugin_list.json deleted file mode 100644 index 82b61ca..0000000 --- a/plugin_list.json +++ /dev/null @@ -1,18 +0,0 @@ -[ - "advanced_calculator", - "bingo", - "bot", - "database_api", - "dict_command_registration", - "fastapi_mcdr", - "gamemode", - "info", - "let_me_click_and_send", - "lowercase_mcdr_command", - "minecraft_command_register", - "more_command_nodes", - "online_player_api", - "qq_api", - "qq_chat", - "uuid_api" -]