Skip to content

Commit

Permalink
Chore: Adding actions for build
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmihi committed Dec 4, 2023
1 parent 107f187 commit 0ffb76d
Show file tree
Hide file tree
Showing 11 changed files with 372 additions and 66 deletions.
19 changes: 19 additions & 0 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: build
description: Base build action for the project
runs:
using: composite
steps:

- name: Install Node.js 18 and setup dependency caching
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: "npm"

- name: Install dependencies
run: npm install --ignore-scripts --fix-lockfile
shell: bash

- name: Build changes
run: npm run build
shell: bash
30 changes: 30 additions & 0 deletions .github/workflows/preview-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Build PR preview

on:
pull_request:
types:
- opened
- reopened
- synchronize
branches:
- development

concurrency:
group: preview-${{ github.ref }}
cancel-in-progress: true

jobs:
build-preview:
name: Build preview
runs-on: ubuntu-latest
steps:
- name: Checkout repository 🛎️
uses: actions/checkout@v3

- name: Build 🏗️
uses: ./.github/actions/build
env:
VITE_APP_ENV: staging

- name: Upload build files 📤
uses: sliit-foss/actions/preview-deployments/postbuild@main
21 changes: 21 additions & 0 deletions .github/workflows/preview-clean.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Clean PR preview

on:
workflow_run:
workflows: ["Close PR"]
types:
- completed

jobs:
close-preview:
name: Close PR preview
runs-on: ubuntu-latest
if: >
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success'
steps:
- name: Checkout repository 🛎️
uses: actions/checkout@v3

- name: Clean preview 🧹
uses: sliit-foss/actions/preview-deployments/clean@main
16 changes: 16 additions & 0 deletions .github/workflows/preview-close-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Close PR

on:
pull_request:
types:
- closed
branches:
- development

jobs:
send-pr-number-to-clean:
name: Record PR number to clean
runs-on: ubuntu-latest
steps:
- name: Upload PR number 📤
uses: sliit-foss/actions/preview-deployments/upload-pr-number@main
24 changes: 24 additions & 0 deletions .github/workflows/preview-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Deploy PR preview

on:
workflow_run:
workflows:
- Build PR preview
types:
- completed

jobs:
deploy-preview:
name: Deploy preview
runs-on: ubuntu-latest
if: >
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success'
steps:
- name: Checkout repository 🛎️
uses: actions/checkout@v3

- name: Deploy preview 🚀
uses: sliit-foss/actions/preview-deployments/deploy@main
with:
site_domain: csse.mrmihi.live
25 changes: 25 additions & 0 deletions .github/workflows/prod-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: CI prod deploy

on:
push:
branches:
- main
jobs:
deploy:
name: Deploy to staging
runs-on: ubuntu-latest
steps:
- name: Checkout repository 🛎️
uses: actions/checkout@v3

- name: Build 🏗️
uses: ./.github/actions/build
env:
build_configuration: production

- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: ./dist/hon/browser
branch: gh-pages
clean-exclude: preview
42 changes: 42 additions & 0 deletions .github/workflows/quality-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Quality Checks

on:
pull_request:
branches:
- main
- development
types:
- opened
- reopened
- synchronize

jobs:
commitlint:
name: Commitlint
runs-on: ubuntu-latest
steps:
- name: Checkout repository 🛎️
uses: actions/checkout@v3

- name: Run commitlint 🟩
uses: sliit-foss/actions/quality-checks/commitlint@main

lint:
name: Enforce ESLint rules
runs-on: ubuntu-latest
steps:
- name: Checkout repository 🛎️
uses: actions/checkout@v3

- name: Run linter 📢
uses: sliit-foss/actions/quality-checks/linter@main

format:
name: Format code
runs-on: ubuntu-latest
steps:
- name: Checkout repository 🛎️
uses: actions/checkout@v3

- name: Run formatter 🧹
uses: sliit-foss/actions/quality-checks/formatter@main
4 changes: 0 additions & 4 deletions .vscode/extensions.json

This file was deleted.

20 changes: 0 additions & 20 deletions .vscode/launch.json

This file was deleted.

42 changes: 0 additions & 42 deletions .vscode/tasks.json

This file was deleted.

Loading

0 comments on commit 0ffb76d

Please sign in to comment.