From 0fb12cf46adf5e6ca9bcd118c5856f4173a46983 Mon Sep 17 00:00:00 2001 From: pengshiyu <1940607002@qq.com> Date: Fri, 7 Jun 2024 22:34:20 +0800 Subject: [PATCH] fix --- .github/workflows/docker-publish.yml | 41 ++++++++++++++++++++++-- .github/workflows/python-publish.yml | 47 +++++++++++++++++++++++----- 2 files changed, 78 insertions(+), 10 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 088762c..c36229f 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -15,22 +15,57 @@ jobs: docker: runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v3 + - name: Install Node.js + uses: actions/setup-node@v3 + with: + node-version: 16 + + - name: Install pnpm + uses: pnpm/action-setup@v2.2.4 + with: + version: 7 + + - name: Checkout Master + uses: actions/checkout@v4 + with: + repository: 'mouday/spider-admin-pro' + ref: 'master' + path: 'spider_admin_pro' + + # 拉取web前端dist的代码 + - name: Checkout Web Dist + uses: actions/checkout@v4 + with: + repository: 'mouday/spider-admin-pro-web' + ref: 'master' + token: ${{ secrets.GH_PAT }} + path: 'spider_admin_pro_web' + + - name: Build Web + run: | + cd spider_admin_pro_web + pnpm install --no-frozen-lockfile + pnpm run build:prod + mkdir -p ../spider_admin_pro/spider_admin_pro/public + cp -r ./dist/* ../spider_admin_pro/spider_admin_pro/public/ + - name: Docker meta id: meta uses: docker/metadata-action@v4 with: images: mouday/spider-admin-pro + - name: Login to Docker Hub uses: docker/login-action@v2 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + + # https://github.com/docker/build-push-action - name: Build Docker Image uses: docker/build-push-action@v2 with: - context: . + context: "{{defaultContext}}:spider-admin-pro" push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index e3db191..63494db 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -22,24 +22,57 @@ jobs: id-token: write steps: - - name: Checkout - uses: actions/checkout@v3 + - name: Checkout Master + uses: actions/checkout@v4 + with: + repository: 'mouday/spider-admin-pro' + ref: 'master' + path: 'spider_admin_pro' + + # 拉取web前端dist的代码 + - name: Checkout Web Dist + uses: actions/checkout@v4 + with: + repository: 'mouday/spider-admin-pro-web' + ref: 'master' + token: ${{ secrets.GH_PAT }} + path: 'spider_admin_pro_web' + + - name: Install Node.js + uses: actions/setup-node@v3 + with: + node-version: 16 + + - name: Install pnpm + uses: pnpm/action-setup@v2.2.4 + with: + version: 7 + + - name: Build Web + run: | + cd spider_admin_pro_web + pnpm install --no-frozen-lockfile + pnpm run build:prod + mkdir -p ../spider_admin_pro/spider_admin_pro/public + cp -r ./dist/* ../spider_admin_pro/spider_admin_pro/public/ + - name: Set up Python uses: actions/setup-python@v3 with: python-version: '3.x' + - name: Install dependencies run: | + cd spider_admin_pro python -m pip install --upgrade pip pip install setuptools wheel twine - - - name: Build - run: | - python setup.py sdist bdist_wheel --python-tag py2.py3 - twine check dist/* + python setup.py sdist bdist_wheel --python-tag py2.py3 + twine check dist/* # Publishing with a Trusted Publisher # https://docs.pypi.org/trusted-publishers/using-a-publisher/ # https://github.com/pypa/gh-action-pypi-publish/ - name: Publish package distributions to PyPI uses: pypa/gh-action-pypi-publish@release/v1 + with: + packages-dir: spider_admin_pro/dist/