Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/add workflows #8

Merged
merged 3 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .githooks/pre-commit
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
28 changes: 28 additions & 0 deletions .github/dependabot.yml
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"
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Node.js 20
uses: actions/setup-node@v4
Expand Down
77 changes: 77 additions & 0 deletions .github/workflows/deploy.yml
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 }}
24 changes: 24 additions & 0 deletions .github/workflows/infisical-secrets-check.yml
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]
27 changes: 27 additions & 0 deletions .github/workflows/size-label.yml
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 }}"
12 changes: 6 additions & 6 deletions .github/workflows/snorkell-auto-documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
44 changes: 44 additions & 0 deletions .github/workflows/sonar-cloud.yml
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 }}
2 changes: 2 additions & 0 deletions GitVersion.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
workflow: GitHubFlow/v1
mode: ContinuousDelivery
Loading