Skip to content

Commit

Permalink
chore: add github worflows
Browse files Browse the repository at this point in the history
  • Loading branch information
andyesp committed Apr 17, 2024
1 parent 57e06bf commit 7a7db7e
Show file tree
Hide file tree
Showing 5 changed files with 169 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Audit

on: [push, pull_request]

jobs:
audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Use Node.js 18.x
uses: actions/[email protected]
with:
node-version: 18.x
cache: 'npm'
- name: Upgrade npm
run: npm i -g npm
- name: Install
run: npm ci --legacy-peer-deps
- name: Audit signatures
run: npm audit signatures
56 changes: 56 additions & 0 deletions .github/workflows/build-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Build and release

on:
push:
branches:
- main
release:
types:
- created

jobs:
build-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- name: Use Node.js 18.x
uses: actions/setup-node@v1
with:
node-version: 18.x
- name: Set package.json version
uses: menduz/oddish-action@master
with:
deterministic-snapshot: true
only-update-versions: true
- name: Install
run: npm ci --legacy-peer-deps
env:
HUSKY: 0
- name: Build
run: npm run build
env:
NODE_PATH: 'src'
NODE_OPTIONS: '--max-old-space-size=6144'
- name: Publish
uses: menduz/oddish-action@master
with:
cwd: './dist'
deterministic-snapshot: true
provenance: false
registry-url: 'https://registry.npmjs.org'
access: public
gitlab-token: ${{ secrets.GITLAB_CDN_DEPLOYER_TOKEN }}
gitlab-pipeline-url: ${{ secrets.GITLAB_CDN_DEPLOYER_URL }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Create Sentry release
if: github.event_name == 'release' && github.event.action == 'created'
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
with:
sourcemaps: ${{ github.workspace }}/dist
version: '${{ vars.SENTRY_RELEASE_PREFIX }}@${{ github.event.release.tag_name }}'
url_prefix: '~'
46 changes: 46 additions & 0 deletions .github/workflows/set-rollout-manual.yaml
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/governance-site)"
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/governance-site"
packageVersion: ${{ github.event.inputs.packageVersion }}

# Rollout information
deploymentPath: "governance"
deploymentEnvironment: ${{ github.event.inputs.deploymentEnvironment }}
deploymentName: "_site"
percentage: ${{ github.event.inputs.rolloutPercentage }}
30 changes: 30 additions & 0 deletions .github/workflows/set-rollout.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
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: 'governance'
deploymentEnvironment: 'zone'
deploymentName: '_site'
percentage: 100
17 changes: 17 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Test

on: [push, pull_request]

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

0 comments on commit 7a7db7e

Please sign in to comment.