Skip to content

fix(ci): install npm globally #271

fix(ci): install npm globally

fix(ci): install npm globally #271

Workflow file for this run

name: Release
on:
push:
branches:
- main
- release/*
- prerelease/*
permissions:
actions: write
contents: write
id-token: write
packages: write
pull-requests: write
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
release:
name: Release
runs-on: ubuntu-latest
outputs:
published: ${{ steps.changeset.outputs.published }}
publishedPackages: ${{ steps.changeset.outputs.publishedPackages }}
steps:
- name: Checkout Repo
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
fetch-depth: 0
- uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
- name: Setup Node.js 20
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 20
cache: "pnpm"
# Minimum required version for npm publish with OIDC Support
# https://docs.npmjs.com/trusted-publishers
- run: |
npm install -g npm@latest
npm --version
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@de808b1eea699e761c404bda44ba8f21aba30b2c # 1.3.1
with:
version: v0.3.0
- name: Install Dependencies
run: pnpm install
- name: Build
run: pnpm build
- name: Test
run: pnpm test
- name: "Report Coverage"
if: always()
uses: davelosert/vitest-coverage-report-action@5a78cb16e761204097ad8a39369ea5d0ff7c8a5d # v2.8.0
with:
working-directory: ./apps/cli
- name: Create Release Pull Request or Publish to npm
id: changeset
uses: changesets/action@06245a4e0a36c064a573d4150030f5ec548e4fcc # v1.4.10
with:
commit: "release: version packages"
publish: pnpm run publish-packages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
packages_to_build:
name: Get released packages
runs-on: ubuntu-latest
needs: release
if: ${{ needs.release.outputs.published == 'true' }}
outputs:
packages: ${{ steps.packages.outputs.PACKAGES }}
steps:
- name: Get released packages
id: packages
run: |
echo "PACKAGES=$(jq -c '[ .[].name ]' <(echo '${{ needs.release.outputs.publishedPackages }}'))" >> "$GITHUB_OUTPUT"
build_sdk:
name: Build sdk
needs: [release, packages_to_build]
if: ${{ needs.release.outputs.published == 'true' && contains(fromJSON(needs.packages_to_build.outputs.packages), '@cartesi/sdk') }}
uses: ./.github/workflows/sdk.yaml
secrets: inherit