Skip to content

Commit

Permalink
feat: Init commit
Browse files Browse the repository at this point in the history
  • Loading branch information
seebeen committed Dec 14, 2021
0 parents commit 9361206
Show file tree
Hide file tree
Showing 23 changed files with 13,956 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# editorconfig.org

root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.php]
indent_size = 4

[*.scss]
indent_size = 2

[*.js]
indent_size = 2
15 changes: 15 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/.github export-ignore
/build export-ignore
/tests export-ignore
/.editorconfig export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.php-cs-fixer.php export-ignore
/.releaserc export-ignore
/CHANGELOG.md export-ignore
/LICENSE export-ignore
/README.md export-ignore
/package.json export-ignore
/package-lock.json export-ignore
/phpcs.xml export-ignore
/phpunit.xml export-ignore
41 changes: 41 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Release
on:
push:
branches:
- master
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/[email protected]
with:
node-version: 16
cache: npm
- name: Install npm dependencies
run: npm install
- name: Cache Composer dependencies
uses: actions/[email protected]
with:
path: /tmp/composer-cache
key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }}
- name: Install composer dependencies
uses: php-actions/composer@v6
with:
php_version: 7.3
version: 2
dev: yes
quiet: yes
args: --optimize-autoloader --classmap-authoritative --prefer-dist
- name: Run Unit tests
run: vendor/bin/phpunit tests
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npm run release

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
vendor
16 changes: 16 additions & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

$finder = PhpCsFixer\Finder::create();

$config = new PhpCsFixer\Config();
return $config->setRules([
'@PSR12' => true,
// 'strict_param' => true,
'array_syntax' => ['syntax' => 'short'],
'braces' => [
'allow_single_line_closure' => true,
'position_after_functions_and_oop_constructs' => 'same'
],
])
->setFinder($finder)
;
24 changes: 24 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"branches": ["master", "next"],
"plugins": [
["@semantic-release/changelog", {
"changelogFile": "CHANGELOG.md"
}],
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
["@semantic-release/exec", {
"prepareCmd": "sh ./build/release.sh ${nextRelease.version}"
}],
["@semantic-release/git", {
"assets": ["CHANGELOG.md", "composer.json"],
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}],
["@semantic-release/github", {
"assets": [{
"path": "build/release.zip",
"name": "serbian-validators-${nextRelease.version}.zip",
"label": "Version ${nextRelease.version}"
}]
}]
]
}
Empty file added CHANGELOG.md
Empty file.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Validates various serbian numbers

Currently validates JMBG, PIB, and MB
8 changes: 8 additions & 0 deletions build/release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#/bin/bash

NEXT_VERSION=$1
CURRENT_VERSION=$(cat composer.json | grep version | head -1 | awk -F= "{ print $2 }" | sed 's/[version:,\",]//g' | tr -d '[[:space:]]')

sed -i "s/\"version\": \"$CURRENT_VERSION\"/\"version\": \"$NEXT_VERSION\"/g" composer.json

zip -r ./build/release.zip composer.json composer.lock src
27 changes: 27 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "oblak/serbian-validators",
"description": "This Module Has useful functions for validating various serbian numbers",
"authors": [
{
"name": "Sibin Grasic",
"email": "[email protected]"
}
],
"license": "GPL-2.0-only",
"version": "1.0.0",
"type": "library",
"require": {
"php" : ">= 7.2"
},
"require-dev": {
"phpunit/phpunit": "^9"
},
"autoload": {
"files": [
"src/utils.php",
"src/validate-jmbg.php",
"src/validate-pib.php",
"src/validate-mb.php"
]
}
}
Loading

0 comments on commit 9361206

Please sign in to comment.