Merge pull request #177 from terrestris/dependabot/npm_and_yarn/react… #155
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
push: | |
branches: | |
- main | |
env: | |
DOCKER_REGISTRY: docker-public.terrestris.de/terrestris | |
jobs: | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources 🔰 | |
uses: actions/checkout@v4 | |
- name: Setup Node.js 18 🧮 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- name: Install dependencies ⏬ | |
run: npm ci | |
- name: Semantic Release 🚀 | |
uses: cycjimmy/semantic-release-action@v4 | |
id: semantic | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
with: | |
semantic_version: 19 | |
- name: Login to Nexus | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.DOCKER_REGISTRY }} | |
username: ${{ secrets.NEXUS_USERNAME }} | |
password: ${{ secrets.NEXUS_PASSWORD }} | |
- name: Build docker image (latest) | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
tags: | | |
${{ env.DOCKER_REGISTRY }}/shogun-admin:latest | |
load: true | |
- name: Build docker image (version) | |
if: steps.semantic.outputs.new_release_published == 'true' | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
tags: | | |
${{ env.DOCKER_REGISTRY }}/shogun-admin:${{ steps.semantic.outputs.new_release_version }} | |
load: true | |
- name: Push docker image to Nexus (latest) | |
run: | | |
docker push ${{ env.DOCKER_REGISTRY }}/shogun-admin:latest | |
- name: Push docker image to Nexus (version) | |
if: steps.semantic.outputs.new_release_published == 'true' | |
run: | | |
docker push ${{ env.DOCKER_REGISTRY }}/shogun-admin:${{ steps.semantic.outputs.new_release_version }} | |
- name: Build docker image e2e-tests (latest) 🏗️ | |
uses: docker/build-push-action@v5 | |
with: | |
file: Dockerfile.e2e | |
context: . | |
tags: | | |
${{ env.DOCKER_REGISTRY }}/shogun-admin-client-e2e-tests:latest | |
load: true | |
- name: Build docker image e2e-tests (version) 🏗️ | |
if: steps.semantic.outputs.new_release_published == 'true' | |
uses: docker/build-push-action@v5 | |
with: | |
file: Dockerfile.e2e | |
context: . | |
tags: | | |
${{ env.DOCKER_REGISTRY }}/shogun-admin-client-e2e-tests:${{ steps.semantic.outputs.new_release_version }} | |
load: true | |
- name: Push docker image to Nexus e2e-tests (latest) 📠 | |
run: | | |
docker push ${{ env.DOCKER_REGISTRY }}/shogun-admin-client-e2e-tests:latest | |
- name: Push docker image to Nexus e2e-tests (version) 📠 | |
if: steps.semantic.outputs.new_release_published == 'true' | |
run: | | |
docker push ${{ env.DOCKER_REGISTRY }}/shogun-admin-client-e2e-tests:${{ steps.semantic.outputs.new_release_version }} | |
sonarqube: | |
name: SonarQube Trigger | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources 🔰 | |
uses: actions/checkout@v4 | |
with: | |
# Disabling shallow clone is recommended for improving relevancy of reporting | |
fetch-depth: 0 | |
- name: Setup Node.js 18 🧮 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- name: Cache Node.js modules 💾 | |
uses: actions/cache@v3 | |
with: | |
path: ~/.npm | |
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.OS }}-node- | |
${{ runner.OS }}- | |
- name: Install dependencies ⏬ | |
run: npm ci | |
- name: Test code ✅ | |
run: npm run test | |
env: | |
CI: true | |
- name: SonarQube Scan 🔬 | |
uses: kitabisa/[email protected] | |
with: | |
host: ${{ secrets.SONARQUBE_HOST }} | |
login: ${{ secrets.SONARQUBE_TOKEN }} |