diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index bfbeb2a5..050d51b4 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -1,10 +1,13 @@ name: "CodeQL" on: - push: - branches: [ "develop" ] - pull_request: - branches: [ "develop" ] + # push: + # branches: + # - develop + # pull_request: + # branches: + # - develop + workflow_dispatch: schedule: - cron: '35 4 * * 5' diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml new file mode 100644 index 00000000..2ca6a450 --- /dev/null +++ b/.github/workflows/pre-release.yml @@ -0,0 +1,101 @@ +name: Pre-release + +on: + # push: + # branches: + # - main + workflow_dispatch: + +env: + REGISTRY: ghcr.io + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + +jobs: + create-pre-release: + runs-on: ubuntu-latest + name: Build and push Docker image and create a new GitHub pre-release + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set environment variables + run: | + echo VERSION=$(cat VERSION).$GITHUB_RUN_NUMBER >> $GITHUB_ENV + echo BASE_IMAGE_NAME=$REGISTRY/$(echo ${GITHUB_REPOSITORY,,}) >> $GITHUB_ENV + echo COMMITED_AT=$(git show -s --format=%cI `git rev-parse HEAD`) >> $GITHUB_ENV + echo REVISION=$(git rev-parse --short HEAD) >> $GITHUB_ENV + + - name: Collect Docker image metadata + id: meta-app + uses: docker/metadata-action@v5 + with: + images: ${{ env.BASE_IMAGE_NAME }}-app-dev + labels: | + org.opencontainers.image.created=${{ env.COMMITED_AT }} + org.opencontainers.image.version=v${{ env.VERSION }} + org.opencontainers.image.maintainer=EBP Schweiz AG + flavor: | + latest=false + tags: | + type=edge + type=semver,pattern=v{{version}},value=${{ env.VERSION }} + + - name: Collect Docker image metadata + id: meta-api + uses: docker/metadata-action@v5 + with: + images: ${{ env.BASE_IMAGE_NAME }}-api-dev + labels: | + org.opencontainers.image.created=${{ env.COMMITED_AT }} + org.opencontainers.image.version=v${{ env.VERSION }} + org.opencontainers.image.maintainer=EBP Schweiz AG + flavor: | + latest=false + tags: | + type=edge + type=semver,pattern=v{{version}},value=${{ env.VERSION }} + + - name: Log in to the GitHub container registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push Docker image (app) + uses: docker/build-push-action@v5 + with: + context: ./apps/client-asset-sg/docker + push: true + build-args: | + VERSION=${{ env.VERSION }} + REVISION=${{ env.REVISION }} + tags: ${{ steps.meta-app.outputs.tags }} + labels: ${{ steps.meta-app.outputs.labels }} + cache-from: type=registry,ref=${{ env.BASE_IMAGE_NAME }}-app-dev:edge + cache-to: type=inline + + - name: Build and push Docker image (api) + uses: docker/build-push-action@v5 + with: + context: ./apps/server-asset-sg/docker + push: true + build-args: | + VERSION=${{ env.VERSION }} + REVISION=${{ env.REVISION }} + tags: ${{ steps.meta-api.outputs.tags }} + labels: ${{ steps.meta-api.outputs.labels }} + cache-from: type=registry,ref=${{ env.BASE_IMAGE_NAME }}-api-dev:edge + cache-to: type=inline + + # - name: Create GitHub pre-release + # run: | + # gh api \ + # --method POST \ + # --header "Accept: application/vnd.github+json" \ + # /repos/${GITHUB_REPOSITORY}/releases \ + # -f tag_name='v${{ env.VERSION }}' \ + # -f target_commitish='main' \ + # -f name='${{ env.VERSION }}' \ + # -F prerelease=true \ \ No newline at end of file diff --git a/.github/workflows/swissgeol-dev.yml b/.github/workflows/swissgeol-dev.yml index 6133b3b0..29781a8f 100644 --- a/.github/workflows/swissgeol-dev.yml +++ b/.github/workflows/swissgeol-dev.yml @@ -1,8 +1,8 @@ name: Swissgeol Asset Dev Deploy on: - push: - branches: ["main"] + # push: + # branches: ["main"] workflow_dispatch: env: APP_IMAGE: ghcr.io/geoadmin/swissgeol-asset-app:dev diff --git a/.github/workflows/swissgeol-int.yml b/.github/workflows/swissgeol-int.yml index 4294496b..efd22c0a 100644 --- a/.github/workflows/swissgeol-int.yml +++ b/.github/workflows/swissgeol-int.yml @@ -1,8 +1,8 @@ name: Swissgeol Asset Int Deploy on: - release: - types: [published] + # release: + # types: [published] workflow_dispatch: inputs: tag: diff --git a/.github/workflows/swissgeol-prod.yml b/.github/workflows/swissgeol-prod.yml index 4528d5fc..2eae1ff1 100644 --- a/.github/workflows/swissgeol-prod.yml +++ b/.github/workflows/swissgeol-prod.yml @@ -1,8 +1,8 @@ name: Swissgeol Asset Prod Deploy on: - release: - types: [published] + # release: + # types: [published] workflow_dispatch: inputs: tag: diff --git a/README.md b/README.md index 92beb409..80f0f8d7 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Assets +# SwissGeol Asset ## Setting up the development environment @@ -10,25 +10,26 @@ The following components must be installed on the development computer: The following steps must be carried out once: -1. Install all necessary modules with `web-asset-swissgeol> npm install`. -2. Decorate the Angular CLI with the Nx CLI `web-asset-swissgeol> npm run postinstall`. -2. Create prisma-client for database-access with `web-asset-swissgeol\apps\server-asset-sg> ng gen-prisma-client`. -3. Set environment variables for dockers in `web-asset-swissgeol\development\.env` -4. Set environment variables for assets-server in `web-asset-swissgeol\apps\server-asset-sg\.env.local` -5. Create local postgis-gotrue docker-image `development\images\db> docker build -t postgis-gotrue .` -6. Creating elastic-search index. Execute in Kibana (`http://localhost:5601/app/dev_tools#/console`) the commands fro file `web-asset-swissgeol\development\init\elasticsearch\index`. --> docker must be started (see below) +1. Clone git repository whit `> git clone https://github.com/geoadmin/web-asset-swissgeol.git`. +2. Install all necessary modules with `web-asset-swissgeol> npm install`. +3. Decorate the Angular CLI with the Nx CLI `web-asset-swissgeol> npm run postinstall`. +4. Create prisma-client for database-access with `web-asset-swissgeol\apps\server-asset-sg> ng gen-prisma-client`. +5. Set environment variables for dockers in `web-asset-swissgeol\development\.env` +6. Set environment variables for assets-server in `web-asset-swissgeol\apps\server-asset-sg\.env.local` +7. Create local postgis-gotrue docker-image `development\images\db> docker build -t postgis-gotrue .` +8. Creating elastic-search index. Execute in Kibana (`http://localhost:5601/app/dev_tools#/console`) the commands fro file `web-asset-swissgeol\development\init\elasticsearch\index`. --> docker must be started (see below) ### Starting the development environment 1. Start docker with `web-asset-swissgeol\development>docker-compose up`. -2. Start assets-app with `web-asset-swissgeol>npm run start`. +2. Start asset-swissgeol app with `web-asset-swissgeol>npm run start`. **The following services/applications are then available** -| 🔖 App/Service | 🔗Link | 🧞User | 🔐Password | -| :---------------------- --| :------------------------------------------------| :---------------------| :---------------------- | -| Assets (client) | [localhost:4200](http://localhost:4200/) | `admin@assets.sg` | `adminAssets` | -| Assets REST API (server) | [localhost:3333/api/](http://localhost:3333/api) | n/a | n/a | +| 🔖App/Service | 🔗Link | 🧞User | 🔐Password | +| :-------------------------| :------------------------------------------------| :---------------------| :-----------------------| +| Asset (client) | [localhost:4200](http://localhost:4200/) | `admin@assets.sg` | `adminAssets` | +| Asset REST API (server) | [localhost:3333/api/](http://localhost:3333/api) | n/a | n/a | | postgresSQL (docker) | localhost:5432 | .env `$DB_USER` |.env `$DB_PASSWORD` | | Elasticsearch (docker) | [localhost:9200](http://localhost:9200) | n/a | n/a | | Kibana (docker) | [localhost:5601](http://localhost:5601) | n/a | n/a | diff --git a/apps/client-asset-sg/docker/Dockerfile b/apps/client-asset-sg/docker/Dockerfile index ae87bd02..da5806f3 100644 --- a/apps/client-asset-sg/docker/Dockerfile +++ b/apps/client-asset-sg/docker/Dockerfile @@ -11,7 +11,7 @@ RUN npx nx build client-asset-sg # final image build FROM nginx:mainline-alpine -LABEL maintainer=support@lambda-it.ch +LABEL maintainer=EBP Schweiz AG WORKDIR /usr/share/nginx/html COPY --from=ui-builder /app/dist/apps/client-asset-sg .