From 412ecd9e928f132e8af90d613b5a79f860eac279 Mon Sep 17 00:00:00 2001 From: fnecas Date: Tue, 30 Jan 2024 10:18:09 +0100 Subject: [PATCH] move docker build outside --- .github/workflows/ci.yml | 30 +-------------------- .github/workflows/docker.yml | 51 ++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 29 deletions(-) create mode 100644 .github/workflows/docker.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c2098eaf..1b7b786b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ permissions: contents: read jobs: - lint-test-build: + main: name: Nx Cloud - Main Job uses: nrwl/ci/.github/workflows/nx-cloud-main.yml@v0.13.1 with: @@ -27,34 +27,6 @@ jobs: npx nx affected --target=test --parallel=3 --ci --code-coverage npx nx affected --target=build --parallel=3 - build-docker: - needs: lint-test-build - name: Build and upload docker image and archive - runs-on: ubuntu-latest - - steps: - - name: Build datahub and produce archives - if: github.event_name == 'release' - run: | - npx nx run-many --projects=datahub --target=build - - - uses: docker/login-action@v1 - name: Login to GitHub Container Registry - with: - registry: ghcr.io - username: c2c-bot-gis-ci - password: ${{ secrets.GOPASS_CI_GITHUB_TOKEN }} - - - name: Setting image tag - id: version - run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3) - - - name: "Pushing the image onto ghcr.io" - run: | - docker image ls --format '{{.Repository}}:{{.Tag}}' --filter=reference='ghcr.io/camptocamp/mel-dataplatform/*' | \ - xargs -r -L1 docker push $1 - - agents: name: Nx Cloud - Agents uses: nrwl/ci/.github/workflows/nx-cloud-agents.yml@v0.13.1 diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 00000000..d45fc7d7 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,51 @@ +name: Docker + +env: + NODE_VERSION: 18.16.1 + +on: + push: + branches: + - main + pull_request: + +jobs: + build-docker: + name: Build and upload docker image and archive + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Use Node.js ${{ env.NODE_VERSION }} + uses: actions/setup-node@v3 + with: + node-version: ${{ env.NODE_VERSION }} + cache: 'npm' + + - name: Install dependencies + run: npm i + + - name: Build datahub + if: github.event_name == 'release' + run: | + npx nx docker-build datahub + + - uses: docker/login-action@v1 + name: Login to GitHub Container Registry + with: + registry: ghcr.io + username: c2c-bot-gis-ci + password: ${{ secrets.GOPASS_CI_GITHUB_TOKEN }} + + - name: "Pushing the image onto ghcr.io" + run: | + docker image ls --format '{{.Repository}}:{{.Tag}}' --filter=reference='ghcr.io/camptocamp/mel-dataplatform/*' | \ + xargs -r -L1 docker push $1 + + + agents: + name: Nx Cloud - Agents + uses: nrwl/ci/.github/workflows/nx-cloud-agents.yml@v0.13.1 + with: + number-of-agents: 3