Skip to content

Commit 4a33c65

Browse files
committed
Configure CI/CD
1 parent fc6117f commit 4a33c65

File tree

6 files changed

+198
-0
lines changed

6 files changed

+198
-0
lines changed

.github/actions/prod/action.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Prod
2+
3+
description: Assemble release
4+
5+
runs:
6+
using: "composite"
7+
steps:
8+
# Checkout code ------------------------------------------------------------
9+
- name: Check out code
10+
uses: actions/checkout@v4
11+
12+
# Setup Nodejs versions ----------------------------------------------------
13+
- name: Setup nodejs
14+
uses: actions/setup-node@v4
15+
with:
16+
node-version: '20.x'
17+
18+
# Print version names ------------------------------------------------------
19+
- name: Output Node version
20+
shell: bash
21+
run: node --version
22+
- name: Output Npm version
23+
shell: bash
24+
run: npm --version
25+
26+
# Get and install all deps -------------------------------------------------
27+
- name: Install Dependencies
28+
shell: bash
29+
run: npm ci
30+
31+
# Build application --------------------------------------------------------
32+
- name: Setup web client
33+
shell: bash
34+
run: npm run build

.github/actions/test/action.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Test
2+
3+
description: Run unit tests
4+
5+
runs:
6+
using: "composite"
7+
steps:
8+
# Checkout code ------------------------------------------------------------
9+
- name: Check out code
10+
uses: actions/checkout@v4
11+
12+
# Setup Nodejs versions ----------------------------------------------------
13+
- name: Setup nodejs
14+
uses: actions/setup-node@v4
15+
with:
16+
node-version: '20.x'
17+
18+
# Print version names ------------------------------------------------------
19+
- name: Output Node version
20+
shell: bash
21+
run: node --version
22+
- name: Output Npm version
23+
shell: bash
24+
run: npm --version
25+
26+
# Get and build all the deps -----------------------------------------------
27+
- name: Install Dependencies
28+
shell: bash
29+
run: npm install
30+
31+
# Run tests ----------------------------------------------------------------
32+
- name: Run tests
33+
shell: bash
34+
run: npm test -- --watchAll=false --passWithNoTests

.github/release-drafter.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name-template: 'v$RESOLVED_VERSION 🌈'
2+
tag-template: 'v$RESOLVED_VERSION'
3+
categories:
4+
- title: '🚀 Features'
5+
labels:
6+
- 'feature'
7+
- 'enhancement'
8+
- title: '🐛 Bug Fixes'
9+
labels:
10+
- 'fix'
11+
- 'bugfix'
12+
- 'bug'
13+
- title: '🧰 Maintenance'
14+
labels:
15+
- 'chore'
16+
- 'scaffolding'
17+
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
18+
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
19+
version-resolver:
20+
major:
21+
labels:
22+
- 'major'
23+
minor:
24+
labels:
25+
- 'minor'
26+
patch:
27+
labels:
28+
- 'patch'
29+
default: patch
30+
template: |
31+
## Changes
32+
33+
$CHANGES

.github/workflows/cd-dev.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: CD-dev
2+
3+
on:
4+
workflow_dispatch:
5+
workflow_run:
6+
workflows: ["CI"]
7+
branches: [dev]
8+
types:
9+
- completed
10+
11+
jobs:
12+
on-success:
13+
runs-on: ubuntu-22.04
14+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
15+
steps:
16+
- name: Cloning repo
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Push to dokku
22+
uses: dokku/github-action@master
23+
with:
24+
# specify the `main` branch as the remote branch to push to
25+
branch: 'main'
26+
git_remote_url: ${{ secrets.SSH_REMOTE_DEV_URL }}
27+
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }}
28+
29+
on-failure:
30+
runs-on: ubuntu-20.04
31+
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
32+
steps:
33+
- run: echo 'The triggering workflow failed'

.github/workflows/ci.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: CI
2+
3+
on:
4+
workflow_dispatch:
5+
# This action is triggered on any branch that opens a pull request.
6+
push:
7+
branches:
8+
- "*"
9+
# This action is not triggered when markdown files are modified.
10+
paths-ignore:
11+
- '**.md'
12+
pull_request:
13+
branches:
14+
- "*"
15+
# This action is not triggered when markdown files are modified.
16+
paths-ignore:
17+
- '**.md'
18+
19+
jobs:
20+
test:
21+
runs-on: ubuntu-22.04
22+
steps:
23+
# Run the dev action -----------------------------------------------------
24+
- uses: actions/[email protected]
25+
- name: Run test checks
26+
uses: ./.github/actions/test
27+
28+
prod:
29+
runs-on: ubuntu-22.04
30+
31+
steps:
32+
# Run the prod action ----------------------------------------------------
33+
- uses: actions/[email protected]
34+
- name: Run production checks
35+
uses: ./.github/actions/prod

.github/workflows/release-drafter.yml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Release Drafter
2+
3+
on:
4+
push:
5+
# branches to consider in the event; optional, defaults to all
6+
branches:
7+
- dev
8+
# pull_request event is required only for autolabeler
9+
pull_request:
10+
# Only following types are handled by the action, but one can default to all as well
11+
types: [opened, reopened, synchronize]
12+
13+
jobs:
14+
update_release_draft:
15+
runs-on: ubuntu-latest
16+
steps:
17+
# (Optional) GitHub Enterprise requires GHE_HOST variable set
18+
#- name: Set GHE_HOST
19+
# run: |
20+
# echo "GHE_HOST=${GITHUB_SERVER_URL##https:\/\/}" >> $GITHUB_ENV
21+
22+
# Drafts your next Release notes as Pull Requests are merged into "main"
23+
- uses: release-drafter/release-drafter@master
24+
# (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml
25+
# with:
26+
# config-name: my-config.yml
27+
# disable-autolabeler: true
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)