Skip to content

Commit

Permalink
feat: re add workflows and husky config
Browse files Browse the repository at this point in the history
  • Loading branch information
braianj committed Nov 28, 2024
1 parent 60d179b commit 12266f6
Show file tree
Hide file tree
Showing 6 changed files with 159 additions and 1 deletion.
24 changes: 24 additions & 0 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Audit

on: [push, pull_request]

jobs:
audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master

- name: Use Node.js 20.x
uses: actions/[email protected]
with:
node-version: 20.x
cache: "npm"

- name: Upgrade npm
run: npm i -g npm

- name: Install
run: npm ci

- name: Audit signatures
run: npm audit signatures
46 changes: 46 additions & 0 deletions .github/workflows/set-rollout-manual.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Set rollout by path - Manual

on:
workflow_dispatch:
inputs:
packageVersion:
description: "NPM Version of the release (@dcl/catalyst-monitor)"
required: true
default: ""
deploymentEnvironment:
type: "choice"
description: "Deployment environment"
required: true
default: "zone"
options:
- zone
- today
- org
rolloutPercentage:
description: "The percentage for this rollout"
required: true
default: "100"

jobs:
set-manual-by-path-rollout:
runs-on: ubuntu-latest
steps:
- uses: hmarr/debug-action@v2
- name: Set Rollout
uses: decentraland/set-rollout-action@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}

# Repo deployment info
ref: ${{ github.event.ref }}
sha: ${{ github.sha }}

# CDN information
packageName: "@dcl/catalyst-monitor"
packageVersion: ${{ github.event.inputs.packageVersion }}

# Rollout information
deploymentPath: "catalyst-monitor"
deploymentEnvironment: ${{ github.event.inputs.deploymentEnvironment }}
deploymentName: "_site"
percentage: ${{ github.event.inputs.rolloutPercentage }}
50 changes: 50 additions & 0 deletions .github/workflows/set-rollout.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Set rollout by path

on: [deployment_status]

jobs:
set-rollout:
if: ${{ github.event.deployment.task == 'upload-to-cdn' && github.event.deployment_status.state == 'success' }}
runs-on: ubuntu-latest
steps:
- uses: hmarr/debug-action@v2

# Dev
- name: Set Rollout - Development
uses: decentraland/set-rollout-action@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}

# Repo deployment info
ref: ${{ github.event.deployment.ref }}
sha: ${{ github.event.deployment.sha }}

# CDN information
packageName: ${{ github.event.deployment.payload.packageName }}
packageVersion: ${{ github.event.deployment.payload.packageVersion }}

# Rollout information
deploymentPath: 'catalyst-monitor-site'
deploymentEnvironment: 'zone'
deploymentName: '_site'
percentage: 100

# Stg
- name: Set Rollout - Staging
uses: decentraland/set-rollout-action@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}

# Repo deployment info
ref: ${{ github.event.deployment.ref }}
sha: ${{ github.event.deployment.sha }}

# CDN information
packageName: ${{ github.event.deployment.payload.packageName }}
packageVersion: ${{ github.event.deployment.payload.packageVersion }}

# Rollout information
deploymentPath: 'catalyst-monitor'
deploymentEnvironment: 'today'
deploymentName: '_site'
percentage: 100
19 changes: 19 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Test

on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- name: Use Node.js 20.x
uses: actions/setup-node@v1
with:
node-version: 20.x
- name: Install
run: npm ci

- name: Test
run: npm run test:coverage
if: ${{ always() }}
18 changes: 17 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
"preview": "vite preview",
"test": "jest",
"test:coverage": "npm run test -- --coverage",
"prepare": "husky",
"precommit": "lint-staged --config .husky/pre-commit.js",
"format": "prettier --write '**/*.{ts,tsx,js,jsx,json,md,mdx,css}'",
"lint": "eslint ./src",
"lint:fix": "npm run lint -- --fix"
Expand Down Expand Up @@ -53,6 +55,7 @@
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-react": "^7.34.3",
"husky": "^9.1.7",
"jest": "^29.7.0",
"lint-staged": "^15.2.7",
"prettier": "^3.3.2",
Expand Down

0 comments on commit 12266f6

Please sign in to comment.