Skip to content

Commit

Permalink
ci(root): merge Docker build into the main nx affected step
Browse files Browse the repository at this point in the history
  • Loading branch information
NexZhu committed Dec 14, 2023
1 parent 563ffb2 commit 6f5f326
Showing 1 changed file with 33 additions and 7 deletions.
40 changes: 33 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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

0 comments on commit 6f5f326

Please sign in to comment.