Skip to content

Commit

Permalink
fix!: pnpm and nvm support
Browse files Browse the repository at this point in the history
Signed-off-by: Promise <[email protected]>
  • Loading branch information
promise committed Feb 13, 2023
1 parent 7d2efda commit 76e6867
Show file tree
Hide file tree
Showing 7 changed files with 2,734 additions and 6,930 deletions.
5 changes: 4 additions & 1 deletion .github/renovate.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"extends": ["github>promise/renovate-config:fully-automated-repository"]
"extends": [
"github>promise/renovate-config:fully-automated-repository",
"github>promise/renovate-config:force-node-version(18)"
]
}
72 changes: 50 additions & 22 deletions .github/workflows/build-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,48 +3,57 @@ name: Build and publish
on:
push:
branches:
- main
- main
pull_request:
branches:
- main
- main
workflow_dispatch:
repository_dispatch:

jobs:
build:
name: Build
name: Test build
runs-on: ubuntu-latest

if: ${{ github.event_name == 'pull_request' }}

steps:
- name: Checkout repository
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3

- name: Set up node
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3
with:
node-version: "18.x"
node-version-file: ".nvmrc"

- name: Restore cached modules
uses: actions/cache@6998d139ddd3e68c71e9e398d8e40b71a2f39812 # v3
id: cache-packages
- name: Set up pnpm
uses: pnpm/action-setup@v2
id: pnpm-install
with:
path: node_modules
key: npm-${{ hashFiles('**/package-lock.json') }}
version: 7
run_install: false

- name: Fallback if module cache fails
run: npm ci
if: steps.cache-packages.outputs.cache-hit != 'true'
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Restore cached build
- name: Set up module cache
uses: actions/cache@6998d139ddd3e68c71e9e398d8e40b71a2f39812 # v3
id: cache-build
id: cache-packages
with:
path: build
key: build-${{ github.sha }}
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
pnpm-store-
- name: Fallback if build cache fails
run: npm run build
if: steps.cache-build.outputs.cache-hit != 'true'
- name: Build and Publish to Worker
uses: cloudflare/wrangler-action@4c10c1822abba527d820b29e6333e7f5dac2cabd # tag=2.0.0
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
accountId: ${{ secrets.CF_ACCOUNT_ID }}
publish: false

publish:
name: Publish
Expand All @@ -59,10 +68,29 @@ jobs:
- name: Set up node
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3
with:
node-version: "18.x"
node-version-file: ".nvmrc"

- name: Set up pnpm
uses: pnpm/action-setup@v2
id: pnpm-install
with:
version: 7
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Install node modules
run: npm ci
- name: Set up module cache
uses: actions/cache@6998d139ddd3e68c71e9e398d8e40b71a2f39812 # v3
id: cache-packages
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
pnpm-store-
- name: Build and Publish to Worker
uses: cloudflare/wrangler-action@4c10c1822abba527d820b29e6333e7f5dac2cabd # tag=2.0.0
Expand Down
28 changes: 21 additions & 7 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,32 @@ jobs:
- name: Set up node
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3
with:
node-version: "18.x"
node-version-file: ".nvmrc"

- name: Restore cached modules
- name: Set up pnpm
uses: pnpm/action-setup@v2
id: pnpm-install
with:
version: 7
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Set up module cache
uses: actions/cache@6998d139ddd3e68c71e9e398d8e40b71a2f39812 # v3
id: cache-packages
with:
path: node_modules
key: npm-${{ hashFiles('**/package-lock.json') }}
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
pnpm-store-
- name: Fallback if module cache fails
run: npm ci
if: steps.cache-packages.outputs.cache-hit != 'true'
- name: Install dependencies
run: pnpm install

- name: Run ESLint
run: npm run lint
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
auto-install-peers=true
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18.14.0
Loading

0 comments on commit 76e6867

Please sign in to comment.