Skip to content

Commit

Permalink
move docker build outside
Browse files Browse the repository at this point in the history
  • Loading branch information
f-necas committed Jan 30, 2024
1 parent 7a76476 commit c732f7b
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 29 deletions.
30 changes: 1 addition & 29 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ permissions:
contents: read

jobs:
lint-test-build:
main:
name: Nx Cloud - Main Job
uses: nrwl/ci/.github/workflows/[email protected]
with:
Expand All @@ -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/[email protected]
Expand Down
55 changes: 55 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Docker

env:
NODE_VERSION: 18.16.1

on:
push:
branches:
- main
pull_request:

jobs:
build-docker:
needs: lint-test-build
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: Run tests
run: npx nx e2e mel-datahub-e2e

- name: Build datahub and produce archives
if: github.event_name == 'release'
run: |
npx nx 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/[email protected]
with:
number-of-agents: 3

0 comments on commit c732f7b

Please sign in to comment.