Skip to content

Commit e814012

Browse files
committed
chore(ci): update workflows to initialize and stop Nx Cloud sessions
1 parent 537f51e commit e814012

File tree

2 files changed

+26
-20
lines changed

2 files changed

+26
-20
lines changed

.github/workflows/nodejs.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ jobs:
1616
steps:
1717
- uses: actions/checkout@v6
1818
with:
19-
# Gestisce sia push che pull request correttamente
2019
ref: ${{ github.event.pull_request.head.ref || github.ref }}
2120
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
2221
fetch-depth: 0
@@ -32,11 +31,13 @@ jobs:
3231
with:
3332
run_install: false
3433

34+
- name: Initialize Nx Cloud
35+
run: npx nx-cloud start-ci-run --distribute-on="5 linux-medium-js"
36+
3537
- name: Setup pnpm cache
3638
uses: actions/cache@v5
3739
with:
38-
path: |
39-
~/.pnpm-store
40+
path: ~/.pnpm-store
4041
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
4142

4243
- name: Install dependencies
@@ -48,7 +49,6 @@ jobs:
4849
- name: Build packages
4950
run: npx nx affected -t build:ci
5051

51-
# Deploy Produzione (Solo su push su main)
5252
- if: env.firebaseToken != '' && github.ref == 'refs/heads/main' && github.event_name == 'push'
5353
uses: FirebaseExtended/action-hosting-deploy@v0
5454
with:
@@ -57,13 +57,13 @@ jobs:
5757
projectId: tsparticles
5858
channelId: live
5959

60-
# Deploy Preview (Solo per PR di matteobruni)
6160
- if: env.firebaseToken != '' && github.event_name == 'pull_request' && github.actor == 'matteobruni'
6261
uses: FirebaseExtended/action-hosting-deploy@v0
6362
with:
6463
repoToken: '${{ secrets.GITHUB_TOKEN }}'
6564
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_TSPARTICLES }}'
6665
projectId: tsparticles
6766

68-
- run: npx nx fix-ci
69-
if: always() # IMPORTANT: Always run
67+
- name: Stop Nx Cloud Session
68+
run: npx nx fix-ci
69+
if: always()

.github/workflows/npm-publish.yml

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,24 @@ jobs:
1919

2020
steps:
2121
- uses: actions/checkout@v6
22+
name: Checkout Source
2223
with:
2324
fetch-depth: 0
2425

2526
- uses: actions/setup-node@v6
27+
name: Setup Node.js
2628
with:
2729
node-version: 24
2830
registry-url: https://registry.npmjs.org
2931

30-
- uses: pnpm/action-setup@v4
32+
- uses: pnpm/action-setup@v4.2.0
33+
name: Install pnpm
3134
with:
3235
run_install: false
3336

37+
- name: Initialize Nx Cloud
38+
run: npx nx-cloud start-ci-run --distribute-on="5 linux-medium-js"
39+
3440
- name: Get pnpm store directory
3541
id: pnpm-cache
3642
run: |
@@ -44,29 +50,28 @@ jobs:
4450
restore-keys: |
4551
${{ runner.os }}-pnpm-store-
4652
47-
- name: Initialize Nx Cloud
48-
run: npx nx-cloud start-ci-run --distribute-on="5 linux-medium-js"
49-
5053
- name: Install Dependencies
5154
run: pnpm ci
5255

5356
- name: Build All Packages
54-
run: npx lerna run build:ci
57+
run: npx nx run-many -t build:ci
5558
env:
5659
CI: true
5760

58-
- name: Publish
61+
- name: Publish to NPM (OIDC Auth)
5962
run: |
60-
npm config set //registry.npmjs.org/:_authToken ""
61-
6263
TAG="${GITHUB_REF#refs/tags/}"
6364
64-
BASE_CMD="lerna publish from-package --ignore-scripts"
65+
# --provenance: Fondamentale per OIDC e sicurezza nel 2026
66+
# --yes: Evita blocchi interattivi in CI
67+
BASE_CMD="npx lerna publish from-package --ignore-scripts --provenance --yes"
68+
69+
echo "Publishing tag: $TAG via OIDC"
6570
6671
if [[ "$TAG" == *"-alpha."* ]]; then
67-
$BASE_CMD --pre-dist-tag alpha --preid alpha
72+
$BASE_CMD --dist-tag alpha
6873
elif [[ "$TAG" == *"-beta."* ]]; then
69-
$BASE_CMD --pre-dist-tag beta --preid beta
74+
$BASE_CMD --dist-tag beta
7075
elif [[ "$TAG" == v1* ]]; then
7176
$BASE_CMD --dist-tag v1
7277
elif [[ "$TAG" == v2* ]]; then
@@ -77,5 +82,6 @@ jobs:
7782
$BASE_CMD
7883
fi
7984
80-
- run: npx nx fix-ci
81-
if: always() # IMPORTANT: Always run
85+
- name: Stop Nx Cloud Session
86+
run: npx nx fix-ci
87+
if: always()

0 commit comments

Comments
 (0)