Skip to content

Commit

Permalink
create pre-release action
Browse files Browse the repository at this point in the history
  • Loading branch information
ga-ebp committed Feb 24, 2024
1 parent 3d45ea4 commit 99aa0c0
Show file tree
Hide file tree
Showing 7 changed files with 129 additions and 24 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -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'

Expand Down
101 changes: 101 additions & 0 deletions .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
@@ -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 \
4 changes: 2 additions & 2 deletions .github/workflows/swissgeol-dev.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/swissgeol-int.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Swissgeol Asset Int Deploy

on:
release:
types: [published]
# release:
# types: [published]
workflow_dispatch:
inputs:
tag:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/swissgeol-prod.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Swissgeol Asset Prod Deploy

on:
release:
types: [published]
# release:
# types: [published]
workflow_dispatch:
inputs:
tag:
Expand Down
27 changes: 14 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Assets
# SwissGeol Asset

## Setting up the development environment

Expand All @@ -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/) | `[email protected]` | `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/) | `[email protected]` | `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 |
Expand Down
2 changes: 1 addition & 1 deletion apps/client-asset-sg/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ RUN npx nx build client-asset-sg

# final image build
FROM nginx:mainline-alpine
LABEL maintainer=[email protected]
LABEL maintainer=EBP Schweiz AG

WORKDIR /usr/share/nginx/html
COPY --from=ui-builder /app/dist/apps/client-asset-sg .
Expand Down

0 comments on commit 99aa0c0

Please sign in to comment.