Skip to content

Commit

Permalink
ci: add semantic release
Browse files Browse the repository at this point in the history
  • Loading branch information
FritzHoing committed May 7, 2024
1 parent 57de564 commit 7ac234c
Show file tree
Hide file tree
Showing 4 changed files with 1,286 additions and 15 deletions.
63 changes: 49 additions & 14 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: Deploy to GitHub Pages
on:
push:
branches:
- deploy
- main

env:
DOCKER_REGISTRY: docker-public.terrestris.de/terrestris
Expand All @@ -14,10 +14,10 @@ jobs:
name: Deploy to GitHub Pages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
cache: npm

- name: Install dependencies
Expand Down Expand Up @@ -64,8 +64,13 @@ jobs:
- name: Install dependencies ⏬
run: npm ci

- name: Build artifacts 🏗️
run: npm run build
- name: Semantic Release 🚀
uses: cycjimmy/semantic-release-action@v4
id: semantic
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
semantic_version: 23

- name: Login to Nexus ⌨️
uses: docker/login-action@v1
Expand All @@ -74,28 +79,58 @@ jobs:
username: ${{ secrets.NEXUS_USERNAME }}
password: ${{ secrets.NEXUS_PASSWORD }}

- name: Build docker gis-client image (main) 🏗️
- name: Build shogun-gis-client-docs docker image (latest) 🏗️
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.gis.client
tags: |
${{ env.DOCKER_REGISTRY }}/shogun-gis-client-docs:latest
load: true

- name: Build shogun-gis-client-docs docker image (version) 🏗️
if: steps.semantic.outputs.new_release_published == 'true'
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.gis.client
tags: |
${{ env.DOCKER_REGISTRY }}/shogun-gis-client-docs:main
${{ env.DOCKER_REGISTRY }}/shogun-gis-client-docs:${{ steps.semantic.outputs.new_release_version }}
load: true

- name: Push docker gis-client image to Nexus (main) 📠
- name: Push shogun-gis-client-docs docker image to Nexus (latest) 📠
run: |
docker push ${{ env.DOCKER_REGISTRY }}/shogun-gis-client-docs:latest
- name: Push shogun-gis-client-docs docker image to Nexus (version) 📠
if: steps.semantic.outputs.new_release_published == 'true'
run: |
docker push ${{ env.DOCKER_REGISTRY }}/shogun-gis-client-docs:main
docker push ${{ env.DOCKER_REGISTRY }}/shogun-gis-client-docs:${{ steps.semantic.outputs.new_release_version }}
- name: Build docker admin-client image (main) 🏗️
- name: Build shogun-admin-client-docs image (latest) 🏗️
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.admin.client
tags: |
${{ env.DOCKER_REGISTRY }}/shogun-admin-client-docs:main
${{ env.DOCKER_REGISTRY }}/shogun-admin-client-docs:latest
load: true

- name: Push docker admin-client image to Nexus (main) 📠
- name: Build shogun-admin-client-docs docker image (version) 🏗️
if: steps.semantic.outputs.new_release_published == 'true'
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.admin.client
tags: |
${{ env.DOCKER_REGISTRY }}/shogun-admin-client-docs:${{ steps.semantic.outputs.new_release_version }}
load: true

- name: Push shogun-admin-client-docs docker image to Nexus (latest) 📠
run: |
docker push ${{ env.DOCKER_REGISTRY }}/shogun-admin-client-docs:latest
- name: Push shogun-admin-client-docs docker image to Nexus (version) 📠
if: steps.semantic.outputs.new_release_published == 'true'
run: |
docker push ${{ env.DOCKER_REGISTRY }}/shogun-admin-client-docs:main
docker push ${{ env.DOCKER_REGISTRY }}/shogun-admin-client-docs:${{ steps.semantic.outputs.new_release_version }}
63 changes: 63 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"branches": [
"main"
],
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"releaseRules": [
{"type": "breaking", "release": "major"},
{"type": "ci", "release": false},
{"type": "config", "release": "patch"},
{"type": "norelease", "release": false},
{"type": "refactor", "release": "patch"},
{"type": "style", "release": "patch"},
{"type": "test", "release": false}
]
}
],
[
"@semantic-release/release-notes-generator",
{
"preset": "conventionalcommits",
"presetConfig": {
"header": "Changelog of shogun-docs",
"types": [
{"type": "breaking", "section": "Breaking changes"},
{"type": "chore", "section": "Dependencies"},
{"type": "ci", "section": "Changes in configuration"},
{"type": "config", "section": "Changes in configuration"},
{"type": "docs", "hidden": true},
{"type": "feat", "section": "Features"},
{"type": "fix", "section": "Bugfixes"},
{"type": "norelease", "hidden": true },
{"type": "perf", "hidden": true},
{"type": "refactor", "hidden": true},
{"type": "style", "section": "Changes in layout"},
{"type": "test", "hidden": true}
]
}
}
],
[
"@semantic-release/npm",
{
"npmPublish": false
}
],
"@semantic-release/changelog",
[
"@semantic-release/git",
{
"assets": [
"CHANGELOG.md",
"package.json",
"package-lock.json"
],
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}
],
"@semantic-release/github"
]
}
Loading

0 comments on commit 7ac234c

Please sign in to comment.