Skip to content

Commit

Permalink
ci: add cicd pipeline
Browse files Browse the repository at this point in the history
reuse cicd pipeline from geostyler-qgis-parser
  • Loading branch information
bsteinemann committed Jun 19, 2024
1 parent 6f4dd53 commit 057aebf
Show file tree
Hide file tree
Showing 7 changed files with 202 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .commitlintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: ['@commitlint/config-conventional']
};
13 changes: 13 additions & 0 deletions .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Lint Commit Messages
on: [pull_request, push]

jobs:
commitlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: wagoid/commitlint-github-action@v5
with:
configFile: .commitlintrc.js
16 changes: 16 additions & 0 deletions .github/workflows/notify-discord.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Discord notification

on:
release:
types: [published]

jobs:
discord-notification:
runs-on: ubuntu-latest
steps:
- name: Discord notification 📯
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
uses: Ilshidur/[email protected]
with:
args: '${{ github.event.repository.name }} [${{ github.event.release.tag_name }}](${{ github.event.release.html_url }}) has been released. 🚀'
48 changes: 48 additions & 0 deletions .github/workflows/on-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Test Pull Request

on: pull_request

jobs:
build:
strategy:
matrix:
node-version: [18.x, 20.x]
os: [ubuntu-latest, windows-latest]

runs-on: ${{ matrix.os }}

steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Cache Node.js modules 💾
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
${{ runner.OS }}-
- name: Install dependencies ⏬
run: npm install

- name: Lint code 💄
run: npm run lint

- name: Test code ✅
run: npm run test

- name: Build artifacts 🏗️
run: npm run build

- name: Publish to coveralls ⭐
# coverage/lcov.info was generated in the previous npm run build step
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
50 changes: 50 additions & 0 deletions .github/workflows/on-push-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Test Push to Main

on:
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x, 20.x]

steps:
- name: Checkout sources
uses: actions/checkout@v3

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- 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 install

- name: Lint code 💄
run: npm run lint

- name: Test code ✅
run: npm run test

- name: Build artifacts 🏗️
run: npm run build

- name: Publish to coveralls ⭐
# coverage/lcov.info was generated in the previous npm run build step
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
35 changes: 35 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Release

on:
workflow_dispatch:

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout sources 🔰
uses: actions/checkout@v4

- name: Setup Node.js 20 👷🏻
uses: actions/setup-node@v4
with:
node-version: 20

- name: Prepare git config
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Install dependencies ⏬
run: npm ci

- name: Build artifacts 🏗️
run: npm run build

- name: Release 🚀
uses: cycjimmy/[email protected]
id: semantic
env:
GITHUB_TOKEN: ${{ secrets.GH_RELEASE_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
37 changes: 37 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"branches": [
"main",
{
"name": "next",
"prerelease": true
}],
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"preset": "conventionalcommits"
}
],
[
"@semantic-release/release-notes-generator",
{
"preset": "conventionalcommits",
"presetConfig": {
"header": "Changelog of GeoStyler Parser for ArcGIS Pro layer files."
}
}
],
"@semantic-release/changelog",
"@semantic-release/npm",
[
"@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"
]
}

0 comments on commit 057aebf

Please sign in to comment.