blocklet / create-blocklet

Bootstrap blocklets within minutes
https://www.createblocklet.dev
Other
9 stars 5 forks source link

[Bug] The default deploy action of static react project breaks if I use npm instead of yarn. #306

Open tianzhich opened 10 months ago

tianzhich commented 10 months ago

The default deploy action is as follows:

name: Npm deployment

on:
  push:
    branches:
      - main

jobs:
  Deploy:
    runs-on: ubuntu-latest

    if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')"

    steps:
      - name: Checkout repo
        uses: actions/checkout@v2

      - name: Use Node.js v16
        uses: actions/setup-node@v2
        with:
          node-version: 16

      - name: Set yarn cache
        uses: c-hive/gha-yarn-cache@v2

      - name: Init
        run: make github-action-init

      - name: Blocklet workflow
        uses: blocklet/action-workflow@v1.1
        with:
          skip-upload: false
          bundle-command: yarn bundle
          store-endpoint: ${{ secrets.STORE_ENDPOINT_DEV }}
          store-access-token: ${{ secrets.STORE_ACCESS_TOKEN_DEV }}
          github-token: ${{ secrets.GITHUB_TOKEN }}

It breaks on the step Set yarn cache:

image

I suggest that we could use action/setup-node to cache the dependencies. It supports multiple package managers and uses action/cache under the hood.

LancelotLewis commented 10 months ago

you might need change this ci workflow to pnpm version which should be like this

name: Npm deployment

on:
  push:
    branches:
      - main

jobs:
  Deploy:
    runs-on: ubuntu-latest

    if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')"

    steps:
      - name: Checkout repo
        uses: actions/checkout@v2

      - uses: pnpm/action-setup@v2.0.1
        with:
          version: latest
      - name: Use Node.js 16
        uses: actions/setup-node@v2
        with:
          node-version: "16"
          cache: "pnpm"

      - name: Init
        run: make github-action-init

      - name: Blocklet workflow
        uses: blocklet/action-workflow@v1.1
        with:
          skip-upload: false
          bundle-command: pnpm bundle
          store-endpoint: ${{ secrets.STORE_ENDPOINT_DEV }}
          store-access-token: ${{ secrets.STORE_ACCESS_TOKEN_DEV }}
          github-token: ${{ secrets.GITHUB_TOKEN }}