Skip to content

Merge pull request #123 from nabla-studio/davidesegullo/fix-node_setup #7

Merge pull request #123 from nabla-studio/davidesegullo/fix-node_setup

Merge pull request #123 from nabla-studio/davidesegullo/fix-node_setup #7

Workflow file for this run

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: 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
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: 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: 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: bun run tools/scripts/release.ts -d false
# Step 10: 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 11: Clean up dist directory
- name: Cleanup dist directory
run: rm -rf ./dist # Remove the dist directory to start fresh