-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat - add pre-commit hook for branch name validation * feat - add GitHub workflows and dependabot configuration files * feat - add GitHub workflows for build process
- Loading branch information
Showing
9 changed files
with
226 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/usr/bin/env bash | ||
LC_ALL=C | ||
|
||
local_branch="$(git rev-parse --abbrev-ref HEAD)" | ||
|
||
valid_branch_regex="^(penify|gitauto|dependabot|feature|fix|docs|style|refactor|perf|hotfix|test|chore|create)(\/[a-zA-Z0-9#._-]+)+$" | ||
|
||
message="There is something wrong with your branch name. Branch names in this project must adhere to this contract: $valid_branch_regex. Your commit will be rejected. You should rename your branch to a valid name and try again." | ||
|
||
if [[ ! $local_branch =~ $valid_branch_regex ]] | ||
then | ||
echo "$message" | ||
exit 1 | ||
fi | ||
|
||
npm run lint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
version: 2 | ||
|
||
updates: | ||
- package-ecosystem: "npm" | ||
directory: "/" | ||
schedule: | ||
interval: weekly | ||
open-pull-requests-limit: 50 | ||
assignees: | ||
- "guibranco" | ||
reviewers: | ||
- "guibranco" | ||
labels: | ||
- "npm" | ||
- "dependencies" | ||
|
||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: weekly | ||
open-pull-requests-limit: 50 | ||
assignees: | ||
- "guibranco" | ||
reviewers: | ||
- "guibranco" | ||
labels: | ||
- "github-actions" | ||
- "dependencies" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
name: Build & Deploy via ftp | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
outputs: | ||
fullSemVer: ${{ steps.gitversion.outputs.fullSemVer }} | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Install GitVersion | ||
uses: gittools/actions/gitversion/[email protected] | ||
with: | ||
versionSpec: "6.x" | ||
|
||
- name: Determine Version | ||
id: gitversion | ||
uses: gittools/actions/gitversion/[email protected] | ||
with: | ||
useConfigFile: true | ||
|
||
- name: Set up Node.js 20 | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20.x | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Build | ||
run: npm run build | ||
|
||
- name: Test | ||
run: npm test | ||
|
||
# - name: Upload build | ||
# uses: sebastianpopp/ftp-action@releases/v2 | ||
# with: | ||
# host: ${{ secrets.FTP_SERVER }} | ||
# user: ${{ secrets.FTP_USERNAME }} | ||
# password: ${{ secrets.FTP_PASSWORD }} | ||
# localDir: "build/" | ||
# remoteDir: "/" | ||
|
||
create_release: | ||
name: Create release | ||
needs: build | ||
runs-on: ubuntu-latest | ||
env: | ||
fullSemVer: ${{ needs.deploy_service.outputs.fullSemVer }} | ||
|
||
steps: | ||
- name: Create Release | ||
uses: ncipollo/[email protected] | ||
with: | ||
skipIfReleaseExists: true | ||
allowUpdates: false | ||
draft: false | ||
makeLatest: true | ||
tag: v${{ env.fullSemVer }} | ||
name: Release v${{ env.fullSemVer }} | ||
generateReleaseNotes: true | ||
body: Release ${{ env.fullSemVer }} of ${{ github.repository }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Infisical secrets check | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
secrets-scan: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
pull-requests: write | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Infisical secrets check | ||
uses: guibranco/[email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Label based on PR size | ||
|
||
on: | ||
pull_request: | ||
pull_request_target: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
size-label: | ||
permissions: write-all | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: size-label | ||
if: >- | ||
( | ||
github.event_name == 'pull_request' && | ||
github.event.pull_request.head.repo.full_name == github.repository | ||
) || ( | ||
github.event_name == 'pull_request_target' && | ||
github.event.pull_request.head.repo.full_name != github.repository | ||
) || ( | ||
github.event_name == 'workflow_dispatch' | ||
) | ||
uses: "pascalgn/[email protected]" | ||
env: | ||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,9 +11,9 @@ jobs: | |
Documentation: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Penify DocGen Client | ||
uses: SingularityX-ai/[email protected] | ||
with: | ||
client_id: ${{ secrets.SNORKELL_CLIENT_ID }} | ||
api_key: ${{ secrets.SNORKELL_API_KEY }} | ||
branch_name: "main" | ||
- name: Penify DocGen Client | ||
uses: SingularityX-ai/[email protected] | ||
with: | ||
client_id: ${{ secrets.SNORKELL_CLIENT_ID }} | ||
api_key: ${{ secrets.SNORKELL_API_KEY }} | ||
branch_name: "main" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Sonar Cloud Analysis | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
pull_request_target: | ||
types: [opened, synchronize, reopened] | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
sonarcloud: | ||
name: SonarCloud | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Install dependencies | ||
run: npm install | ||
|
||
- name: Test and coverage | ||
run: npm run test -- --coverage --watchAll=false | ||
|
||
- name: SonarCloud Scan | ||
uses: SonarSource/sonarcloud-github-action@master | ||
if: >- | ||
( | ||
github.event_name == 'pull_request' && | ||
github.event.pull_request.head.repo.full_name == github.repository | ||
) || ( | ||
github.event_name == 'pull_request_target' && | ||
github.event.pull_request.head.repo.full_name != github.repository | ||
) || ( | ||
github.event_name == 'workflow_dispatch' | ||
) | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
workflow: GitHubFlow/v1 | ||
mode: ContinuousDelivery |