Skip to content

Commit

Permalink
feat: CI ready
Browse files Browse the repository at this point in the history
  • Loading branch information
f-necas committed Jan 30, 2024
1 parent 7a76476 commit 95e3b44
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 33 deletions.
38 changes: 23 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: CI

env:
NODE_VERSION: 18.16.1

on:
push:
branches:
Expand All @@ -10,6 +13,7 @@ on:
permissions:
actions: read
contents: read
packages: write

jobs:
lint-test-build:
Expand All @@ -27,33 +31,37 @@ jobs:
npx nx affected --target=test --parallel=3 --ci --code-coverage
npx nx affected --target=build --parallel=3
build-docker:
push-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: 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 docker-build
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 }}
username: ${{ github.actor }}
password: ${{ secrets.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"
- name: 'Pushing the image onto ghcr.io'
if: github.ref == 'refs/heads/main'
run: |
docker image ls --format '{{.Repository}}:{{.Tag}}' --filter=reference='ghcr.io/camptocamp/mel-dataplatform/*' | \
xargs -r -L1 docker push $1
docker push ghcr.io/camptocamp/mel-dataplatform/datahub:latest
agents:
name: Nx Cloud - Agents
Expand Down
4 changes: 2 additions & 2 deletions apps/datahub/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@
"executor": "nx:run-commands",
"options": {
"commands": [
"nx build datahub --base-href='/datahub/'",
"docker build --build-arg APP_NAME=datahub -f ./tools/docker/Dockerfile . -t $(tools/print-docker-tag.sh datahub) -t ghcr.io/camptocamp/mel-dataplatform/datahub:latest"
"nx build datahub",
"docker build --build-arg APP_NAME=datahub -f ./tools/docker/Dockerfile . -t ghcr.io/camptocamp/mel-dataplatform/datahub:latest"
],
"parallel": false
}
Expand Down
16 changes: 0 additions & 16 deletions tools/print-docker-tag.sh

This file was deleted.

0 comments on commit 95e3b44

Please sign in to comment.