Skip to content

Commit

Permalink
Merge pull request #117 from nabla-studio/davidesegullo/ci-new_releas…
Browse files Browse the repository at this point in the history
…e_workflows

Davidesegullo/ci new release workflows
  • Loading branch information
DavideSegullo authored Oct 26, 2024
2 parents 4ba6450 + 579c4b9 commit a0be46a
Show file tree
Hide file tree
Showing 21 changed files with 284 additions and 707 deletions.
24 changes: 0 additions & 24 deletions .github/actions/release/action.yml

This file was deleted.

54 changes: 0 additions & 54 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.

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

on:
pull_request:

jobs:
checks:
runs-on: ubuntu-latest
environment: ${{ github.ref_name == 'main' && 'production' || github.ref_name == 'v1' && 'production' || 'preview' }}
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: Set up bun package manager
- name: Install bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest

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

- 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: bun 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: bunx 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: bun run tools/scripts/release.ts

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

on:
push:
branches:
- next

jobs:
release:
runs-on: ubuntu-latest
environment: preview
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_PREID: ${{ vars.RELEASE_PREID }}
RELEASE_SPECIFIER: ${{ vars.RELEASE_SPECIFIER }}
RELEASE_TAG: ${{ vars.RELEASE_TAG }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

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: Set up bun package manager
- name: Install bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest

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

- 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: bun 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: bunx 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: bun run tools/scripts/release.ts -d false

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

on:
push:
branches:
- main
- v1

jobs:
release:
runs-on: ubuntu-latest
environment: production
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

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: Set up bun package manager
- name: Install bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest

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

- 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: bun 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: bunx 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: bun run tools/scripts/release.ts -d false

# Step 9: Clean up dist directory
- name: Cleanup dist directory
run: rm -rf ./dist # Remove the dist directory to start fresh
45 changes: 0 additions & 45 deletions .github/workflows/release.yml

This file was deleted.

Binary file modified bun.lockb
Binary file not shown.
19 changes: 18 additions & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,22 @@
"libsDir": "packages"
},
"useInferencePlugins": false,
"useLegacyCache": true
"useLegacyCache": true,
"release": {
"projects": ["*", "!nextjs", "!vue3", "!@quirks/source"],
"projectsRelationship": "independent",
"version": {
"generatorOptions": {
"currentVersionResolver": "git-tag",
"specifierSource": "conventional-commits",
"fallbackCurrentVersionResolver": "disk"
}
},
"changelog": {
"projectChangelogs": {
"createRelease": "github"
},
"automaticFromRef": true
}
}
}
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"@babel/preset-react": "^7.14.5",
"@commitlint/cli": "^17.0.0",
"@commitlint/config-conventional": "^17.0.0",
"@jscutlery/semver": "^4.0.0",
"@nx/devkit": "20.0.5",
"@nx/eslint": "20.0.5",
"@nx/eslint-plugin": "20.0.5",
Expand All @@ -34,6 +33,7 @@
"@types/react": "18.3.1",
"@types/react-dom": "18.3.0",
"@types/semver": "^7.5.4",
"@types/yargs": "^17.0.33",
"@typescript-eslint/eslint-plugin": "7.18.0",
"@typescript-eslint/parser": "7.18.0",
"@vitejs/plugin-react": "4.3.3",
Expand Down Expand Up @@ -62,7 +62,6 @@
"jest-environment-jsdom": "29.7.0",
"jsdom": "^22.1.0",
"json-schema-to-typescript": "^13.1.1",
"ngx-deploy-npm": "^7.0.1",
"nx": "20.0.5",
"prettier": "^3.0.3",
"ts-jest": "^29.1.1",
Expand All @@ -73,7 +72,8 @@
"vite": "5.4.9",
"vite-plugin-dts": "~2.3.0",
"vitest": "2.1.3",
"vue-tsc": "2.1.6"
"vue-tsc": "2.1.6",
"yargs": "^17.7.2"
},
"nx": {
"includedScripts": []
Expand Down
Loading

0 comments on commit a0be46a

Please sign in to comment.