Skip to content

Commit

Permalink
Merge pull request #127 from nabla-studio/next
Browse files Browse the repository at this point in the history
feat: update nx and release workflows
  • Loading branch information
DavideSegullo authored Oct 27, 2024
2 parents 3d968a2 + 98c003d commit dd3ac9f
Show file tree
Hide file tree
Showing 373 changed files with 10,887 additions and 144,662 deletions.
22 changes: 20 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx", "*.vue"],
"rules": {
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-empty-interface": "off",
"@nx/enforce-module-boundaries": [
"error",
{
Expand All @@ -24,12 +28,26 @@
{
"files": ["*.ts", "*.tsx"],
"extends": ["plugin:@nx/typescript"],
"rules": {}
"rules": {
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-extra-semi": "error",
"@typescript-eslint/no-empty-interface": "off",
"no-extra-semi": "off"
}
},
{
"files": ["*.js", "*.jsx"],
"extends": ["plugin:@nx/javascript"],
"rules": {}
"rules": {
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-extra-semi": "error",
"@typescript-eslint/no-empty-interface": "off",
"no-extra-semi": "off"
}
}
]
}
24 changes: 0 additions & 24 deletions .github/actions/release/action.yml

This file was deleted.

67 changes: 0 additions & 67 deletions .github/actions/setup/action.yml

This file was deleted.

17 changes: 0 additions & 17 deletions .github/actions/test/action.yml

This file was deleted.

82 changes: 82 additions & 0 deletions .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: PR Checks (Dry-Run)

on:
pull_request:

jobs:
checks:
runs-on: ubuntu-latest
environment: ${{ github.base_ref == 'main' && 'production' || github.base_ref == 'v1' && 'production' || 'preview' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_PREID: ${{ vars.RELEASE_PREID }}
CUSTOM_BASE_REF: ${{ github.base_ref }}
CUSTOM_REF_NAME: ${{ github.ref_name }}
CUSTOM_HEAD_REF: ${{ github.head_ref }}
RELEASE_SPECIFIER: ${{ vars.RELEASE_SPECIFIER }}
RELEASE_TAG: ${{ vars.RELEASE_TAG }}

steps:
# Step 1: Check out the repository code
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch the entire history to allow proper versioning

# Step 2: Setup pnpm package manager
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
run_install: false

# Step 3: Set up Node.js environment
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'

- name: Cache dependencies
uses: actions/cache@v4
with:
path: '**/node_modules'
key: ${{ runner.OS }}-20.x-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.OS }}-20.x-
# Step 5: Install dependencies
- name: Install dependencies
run: pnpm i --frozen-lockfile

# Step 6: Set SHAs for nx workspace
- name: Set SHAs for Nx workspace
uses: nrwl/nx-set-shas@v4

# Step 7: Run the build for the affected changes
- name: Run Nx lint, test and build
run: pnpx nx affected -t lint test build --exclude nextjs,vue3

# Step 8: Run the release in dry-run mode
- name: Run Nx release version (dry-run)
run: pnpm release

# Step 9: Run publish in dry-run mode
- name: Publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_CONFIG_PROVENANCE: true
# Use npx instead of yarn because yarn automagically sets NPM_* environment variables
# like NPM_CONFIG_REGISTRY so npm publish ends up ignoring the .npmrc file
# which is set up by `setup-node` action.
run: pnpx nx release publish --verbose --dry-run

# Step 10: Upload artifacts
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
path: './dist'

# Step 11: Clean up dist directory
- name: Cleanup dist directory
run: rm -rf ./dist # Remove the dist directory to start fresh
89 changes: 89 additions & 0 deletions .github/workflows/release-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Release

on:
push:
branches:
- next

jobs:
release:
runs-on: ubuntu-latest
environment: preview
permissions:
contents: write
id-token: write # needed for provenance data generation
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_PREID: ${{ vars.RELEASE_PREID }}
RELEASE_SPECIFIER: ${{ vars.RELEASE_SPECIFIER }}
RELEASE_TAG: ${{ vars.RELEASE_TAG }}

steps:
# Step 1: Check out the repository code
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch the entire history to allow proper versioning

# Step 2: Setup pnpm package manager
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
run_install: false

# Step 3: Set up Node.js environment
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
registry-url: 'https://registry.npmjs.org'

- name: Cache dependencies
uses: actions/cache@v4
with:
path: '**/node_modules'
key: ${{ runner.OS }}-20.x-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.OS }}-20.x-
# Step 5: Install dependencies
- name: Install dependencies
run: pnpm i --frozen-lockfile

# Step 6: Set SHAs for nx workspace
- name: Set SHAs for Nx workspace
uses: nrwl/nx-set-shas@v4

# Step 7: Run the build for the affected changes
- name: Run Nx lint, test and build
run: pnpx nx affected -t lint test build --exclude nextjs,vue3

# Step 8: Set github authour
- name: Setup git user to "🤖 nabla bot"
run: git config user.email "-" && git config user.name "🤖 nabla bot"

# Step 9: Run the release
- name: Run Nx release version
run: pnpm release -d false

# Step 10: Run the build for the affected changes
- name: Run build
run: pnpm build

# Step 11: Run publish
- name: Publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_CONFIG_PROVENANCE: true
# Use npx instead of yarn because yarn automagically sets NPM_* environment variables
# like NPM_CONFIG_REGISTRY so npm publish ends up ignoring the .npmrc file
# which is set up by `setup-node` action.
run: npx nx release publish --verbose --tag $RELEASE_TAG

# Step 12: Upload artifacts
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
path: './dist'
Loading

0 comments on commit dd3ac9f

Please sign in to comment.