Skip to content

Commit

Permalink
chore(actions): fix workflows for pnpm
Browse files Browse the repository at this point in the history
  • Loading branch information
SapphicMoe committed Jan 1, 2024
1 parent 4dc6ad2 commit bbbee3d
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 33 deletions.
5 changes: 5 additions & 0 deletions .changeset/thin-feet-add.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@solely/simple-fm": minor
---

Lots of internal changes made (types, etc). Fixed some annoying bugs with some methods.
40 changes: 24 additions & 16 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,35 @@ jobs:
steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: '16'
node-version: 18

- run: npm install -g yarn

- id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: 8
run_install: false

- run: |
touch .env
echo LASTFM_TOKEN=${{ secrets.LASTFM_TOKEN }} >> .env
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
id: yarn-cache
name: Setup pnpm cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-yarn-
${{ runner.os }}-pnpm-store-
- name: Add .env file
- run: |
touch .env
echo LASTFM_TOKEN=${{ secrets.LASTFM_TOKEN }} >> .env
- run: yarn install --immutable
- run: yarn test
- run: yarn build
- run: pnpm install --frozen-lockfile
- run: pnpm test
- run: pnpm build
34 changes: 19 additions & 15 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ on:
branches:
- 'main'

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
publish:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
Expand All @@ -18,34 +16,40 @@ jobs:
- name: Checkout Repo
uses: actions/checkout@v2

- name: Setup Node.js 16.x
uses: actions/setup-node@v2
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16.x
node-version: 18

- run: npm install -g yarn
- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: 8
run_install: false

- id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
id: yarn-cache
name: Setup pnpm cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-yarn-
${{ runner.os }}-pnpm-store-
- name: Install Dependencies
run: yarn install --immutable
run: pnpm install --frozen-lockfile

- name: Create Release Pull Request or Publish to npm
# https://github.com/changesets/action
uses: changesets/action@v1
with:
# this expects you to have a script called release which does a build for your packages and calls changeset publish
publish: yarn prepare
version: yarn version
publish: pnpm ci:publish
version: pnpm ci:version
commit: 'chore(changesets): release'
title: 'chore(changesets): release'
env:
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@
],
"scripts": {
"build": "tsc -p tsconfig.build.json && tsconfig-replace-paths -p tsconfig.build.json -s src/",
"ci:publish": "pnpm publish -r",
"ci:version": "pnpm changeset version",
"dev": "tsc --watch",
"lint": "pnpm eslint .",
"package": "tar -xvf solely-simple-fm-*.tgz && pnpm rimraf ./solely-simple-fm-*.tgz",
"prepublish": "rimraf ./dist && pnpm build",
"preview": "pnpm pack && pnpm package",
"test": "vitest",
"version": "pnpm changeset version"
"test": "vitest"
},
"publishConfig": {
"access": "public"
Expand Down

0 comments on commit bbbee3d

Please sign in to comment.