Skip to content

Commit

Permalink
ci: refactor pipelines
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominique Börner committed Mar 13, 2024
1 parent 0ede81a commit 87d653c
Show file tree
Hide file tree
Showing 6 changed files with 139 additions and 90 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Deploy to dev

on:
workflow_run:
workflows: ["Testing - fox-deck-app", "Testing - fox-deck-api", "Build & Deploy - Documentation"]
type:
- completed

jobs:
# build and deploy the app
deploy_app:
runs-on: ubuntu-latest
name: Build and deploy the app
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install dependencies
run: npm run install:app
- name: ⚙️ Build app
run: npm run build:app
- name: Print execution time
run: echo "Time ${{ steps.adocbuild.outputs.time }}"
- name: 📂 Upload fox-deck-app via SFTP
uses: wlixcc/[email protected]
with:
username: ${{ secrets.FTP_DEV_USERNAME }}
server: ${{ secrets.FTP_SERVER }}
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }}
port: ${{ secrets.FTP_PORT }}
local_path: './apps/fox-deck-app/dist/*'
remote_path: '/var/www/dev'
sftp_only: true
34 changes: 34 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Build & Deploy - Documentation

on:
pull_request:
paths:
- "docs/**"
branches:
- master
push:
paths:
- "docs/**"
branches:
- master

jobs:
# build and deploy the documentation
deploy_docs:
runs-on: ubuntu-latest
name: Generate and deploy developer documentation
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: ⚙️ Build documentation
run: npm run docs
- name: 📂 Upload documentation via SFTP
uses: wlixcc/[email protected]
with:
username: ${{ secrets.FTP_DEV_USERNAME }}
server: ${{ secrets.FTP_SERVER }}
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }}
port: ${{ secrets.FTP_PORT }}
local_path: './docs/build/site/*'
remote_path: '/var/www/docs'
sftp_only: true
28 changes: 28 additions & 0 deletions .github/workflows/fox-deck-api.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Testing - fox-deck-api

on:
pull_request:
branches:
- master
push:
branches:
- master

jobs:
# testing the fox-deck frontend
test_app:
runs-on: ubuntu-latest
env:

defaults:
run:
working-directory: ./apps/fox-deck-api
name: Run Unit-Tests
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '18.x'
- run: npm ci
- run: npm run test:unit
30 changes: 30 additions & 0 deletions .github/workflows/fox-deck-app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Testing - fox-deck-app

on:
pull_request:
branches:
- master
push:
branches:
- master

jobs:
# testing the fox-deck frontend
test_app:
runs-on: ubuntu-latest
env:

defaults:
run:
working-directory: ./apps/fox-deck-app
name: Run Unit-Tests
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '18.x'
- name: Rename environment file
run: mv .env.example .env
- run: npm ci
- run: npm run test
18 changes: 15 additions & 3 deletions .github/workflows/prod-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,19 @@ jobs:
deploy_to_production:
if: contains('["dominique-boerner", "Eric-Schubert"]', github.actor)
runs-on: ubuntu-latest
name: Deploy to production
name: Deploy to docker
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
push: true
tags: user/app:latest
87 changes: 0 additions & 87 deletions .github/workflows/test-and-deploy.yml

This file was deleted.

0 comments on commit 87d653c

Please sign in to comment.