From 4186399af59624d1510515f7f2f215b72a687464 Mon Sep 17 00:00:00 2001 From: JinnLynn Date: Tue, 25 Jun 2024 09:09:39 +0800 Subject: [PATCH] perf(action): cook --- .github/workflows/cook-branch.yml | 48 ---------------------------- .github/workflows/cook.yml | 53 ++++++++++++++++++++++++------- 2 files changed, 42 insertions(+), 59 deletions(-) delete mode 100644 .github/workflows/cook-branch.yml diff --git a/.github/workflows/cook-branch.yml b/.github/workflows/cook-branch.yml deleted file mode 100644 index 8d5fb5de..00000000 --- a/.github/workflows/cook-branch.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: cook-branch -on: - workflow_call: - inputs: - branch: - type: string - default: master - required: true -jobs: - cooking: - runs-on: ubuntu-latest - permissions: - contents: write - steps: - - name: Checkout Branch - uses: actions/checkout@v4 - with: - ref: ${{ inputs.branch }} - path: work - - uses: actions/setup-python@v5 - with: - python-version: '3.12' - - name: fire - id: fire - run: | - pip install ./work/ && \ - mkdir -p ./tmp && - cd ./tmp && \ - genpac --config=../work/example/config.ini && \ - ls -alhR ./ && \ - echo "gen_time=$(date '+%Y-%m-%d %H:%M:%S %z')" >>$GITHUB_OUTPUT - - name: Checkout Branch cooked - uses: actions/checkout@v4 - with: - ref: cooked - path: cooked - - name: copy - run: | - mkdir -p ./cooked/${{ inputs.branch }} && \ - rm -rf ./cooked/${{ inputs.branch }}/* && \ - cp ./tmp/* ./cooked/${{ inputs.branch }}/ - - name: commit - uses: stefanzweifel/git-auto-commit-action@v5 - with: - repository: ./cooked - commit_message: update ${{ steps.fire.outputs.gen_time }} - add_options: '-A' - push_options: '--force' diff --git a/.github/workflows/cook.yml b/.github/workflows/cook.yml index f5aa8e50..e41faa9c 100644 --- a/.github/workflows/cook.yml +++ b/.github/workflows/cook.yml @@ -4,15 +4,46 @@ on: schedule: - cron: "0 */12 * * *" push: - + branches: + - master + - dev jobs: - master: - if: ${{ github.ref_name == 'master' || github.event.schedule }} - uses: ./.github/workflows/cook-branch.yml - with: - branch: master - dev: - if: ${{ github.ref_name == 'dev' || github.event.schedule }} - uses: ./.github/workflows/cook-branch.yml - with: - branch: dev + cook: + runs-on: ubuntu-latest + permissions: + contents: write + strategy: + max-parallel: 1 + matrix: + branch: [master, dev] + steps: + - uses: actions/setup-python@v5 + with: + python-version: '3.12' + - name: Checkout Branch + uses: actions/checkout@v4 + with: + ref: ${{ matrix.branch }} + path: src + - name: Checkout Branch cooked + uses: actions/checkout@v4 + with: + ref: cooked + path: cooked + - name: fire + id: fire + run: | + pip install ./src/ && \ + mkdir -p ./cooked/${{ matrix.branch }} && \ + cd ./cooked/${{ matrix.branch }} && \ + rm -rf * && \ + genpac --config=../../src/example/config.ini && \ + ls -lh ./ && \ + echo "gen_time=$(date '+%Y-%m-%d %H:%M:%S %z')" >>$GITHUB_OUTPUT + - name: commit + uses: stefanzweifel/git-auto-commit-action@v5 + with: + repository: ./cooked + commit_message: update ${{ steps.fire.outputs.gen_time }} + add_options: '-A' + push_options: '--force'