diff --git a/.github/workflows/commitlint.yml b/.github/workflows/commitlint.yml index be68c23..7cd3d76 100644 --- a/.github/workflows/commitlint.yml +++ b/.github/workflows/commitlint.yml @@ -1,10 +1,6 @@ -# This is a basic workflow to help you get started with Actions - name: Check Commit spec -# Controls when the action will run. on: - # Triggers the workflow on push or pull request events but only for the formily_next branch push: branches: [master] pull_request: @@ -13,17 +9,16 @@ on: # Allows you to run this workflow manually from the Actions tab workflow_dispatch: -# A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: - # This workflow contains a single job called "build" commitlint: - # The type of runner that the job will run on runs-on: ubuntu-latest - - # Steps represent a sequence of tasks that will be executed as part of the job + permissions: + contents: read + pull-requests: read steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0= - uses: wagoid/commitlint-github-action@v3 + env: + NODE_PATH: ${{ github.workspace }}/node_modules diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 66c6222..40596b7 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -91,13 +91,13 @@ jobs: - name: Build the Docker image run: | # 使用 上一步写的 Dockerfile 构建镜像并发布到私有仓库; 发布完成可以去 https://github.com/aceHubert?tab=packages 查看 - docker build . --file Dockerfile --target deploy --cache-from ghcr.io/${{ env.IMAGE_REPOSITORY }}:latest --build-arg BUILD_IGNORE=true --build-arg BUILDKIT_INLINE_CACHE=1 --tag ghcr.io/${{ env.IMAGE_REPOSITORY }}:latest --tag ghcr.io/${{ env.IMAGE_REPOSITORY }}:${{ github.run_id }}-${{ github.ref_name }} - docker push ghcr.io/${{ env.IMAGE_REPOSITORY }}:${{ github.run_id }}-${{ github.ref_name }} + docker build . --file Dockerfile --target deploy --cache-from ghcr.io/${{ env.IMAGE_REPOSITORY }}:latest --build-arg BUILD_IGNORE=true --build-arg BUILDKIT_INLINE_CACHE=1 --tag ghcr.io/${{ env.IMAGE_REPOSITORY }}:latest --tag ghcr.io/${{ env.IMAGE_REPOSITORY }}:${{ github.run_id }} + docker push ghcr.io/${{ env.IMAGE_REPOSITORY }}:${{ github.run_id }} docker push ghcr.io/${{ env.IMAGE_REPOSITORY }}:latest env: IMAGE_REPOSITORY: $(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]') deploy: - # needs: build + needs: build runs-on: ubuntu-latest environment: name: 'production' @@ -111,7 +111,7 @@ jobs: port: ${{ secrets.SSH_PORT }} # 服务器端口,默认22;需要去仓库的 settings/secrets/actions 去创建 script: | # 重启更新镜像 cd ${{ env.CONTENT_DIR }} - echo "IMAGE_REPOSITORY=ghcr.io/${{ env.IMAGE_REPOSITORY }}:${{ github.run_id }}-${{ github.ref_name }}" > .env.${{ github.run_id }} + echo "IMAGE_REPOSITORY=ghcr.io/${{ env.IMAGE_REPOSITORY }}:${{ github.run_id }}" > .env.${{ github.run_id }} docker login -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} https://ghcr.io docker compose --env-file .env.${{ github.run_id }} up --force-recreate -d env: