From 6f5f3268acebb00b4c9d2d8c1dda9ac09e38139d Mon Sep 17 00:00:00 2001 From: Nex Zhu Date: Thu, 14 Dec 2023 15:39:09 +0800 Subject: [PATCH] ci(root): merge Docker build into the main nx affected step --- .github/workflows/ci.yml | 40 +++++++++++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b0a53cd..20e15ad 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -73,10 +73,6 @@ jobs: # https://github.com/pnpm/pnpm/issues/6300#issuecomment-1722120409 run: CYPRESS_INSTALL_BINARY=0 ./scripts/pnpm-install-filtered.js --frozen-lockfile=true ${{ steps.affected.outputs.projs }} - - run: pnpm nx affected -t build lint - - # Build Docker images - - uses: docker/setup-buildx-action@v3 id: docker-setup-buildx if: github.ref == 'refs/heads/main' && github.event_name == 'push' && matrix.node-version == '20.x' @@ -87,9 +83,39 @@ jobs: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build and push Docker images - if: github.ref == 'refs/heads/main' && github.event_name == 'push' && matrix.node-version == '20.x' + - name: nx affected env: INPUT_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} INPUT_BUILDER: ${{ steps.docker-setup-buildx.outputs.name }} - run: pnpm nx affected -t container -c ci + run: | + targets='build lint' + echo ${{ github.ref }} + echo ${{ github.event_name }} + echo ${{ matrix.node-version }} + if [ '${{ github.ref }}' = 'refs/heads/main' ]; then + echo 1 + fi + if [ "${{ github.ref }}" = 'refs/heads/main' ]; then + echo 2 + fi + if [ ${{ github.ref }} = 'refs/heads/main' ]; then + echo 3 + fi + if [ '${{ github.event_name }}' = 'push' ]; then + echo 4 + fi + if [ "${{ github.event_name }}" = 'push' ]; then + echo 5 + fi + if [ ${{ github.event_name }} = 'push' ]; then + echo 6 + fi + if [ '${{ github.ref }}' = 'refs/heads/main' ] && '${{ github.event_name }}' = 'push'; then + echo 7 + targets="${targets} container" + fi + echo ${targets} + if [ '${{ github.ref }}' = 'refs/heads/main' ] && [ '${{ github.event_name }}' = 'push' ] && [ '${{ matrix.node-version }}' = '20.x' ]; then + targets="${targets} container" + fi + pnpm nx affected -t ${targets} -c ci