Try latest with npm:[email protected] #16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: try | |
run-name: Try ${{ inputs.effector-storage || 'latest' }} with ${{ inputs.effector }} | |
on: | |
workflow_dispatch: | |
inputs: | |
effector: | |
description: effector dependency | |
required: false | |
default: "npm:[email protected]" | |
type: string | |
effector-storage: | |
description: effector-storage dependency | |
required: false | |
type: string | |
workflow_call: | |
inputs: | |
effector: | |
description: effector dependency | |
required: true | |
type: string | |
effector-storage: | |
description: effector-storage dependency | |
required: false | |
type: string | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: | |
- 18 | |
- 20 | |
name: Node ${{ matrix.node-version }} / ${{ inputs.effector }} / ${{ inputs.effector-storage || 'latest' }} | |
steps: | |
- name: 📦 Get effector-storage latest package version | |
id: get_latest_version | |
if: inputs.effector-storage == '' | |
uses: octokit/[email protected] | |
with: | |
route: GET /users/{username}/packages/npm/effector-storage/versions | |
env: | |
INPUT_USERNAME: ${{ github.repository_owner }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: 📦 Generate effector-storage latest package | |
id: get_latest_package | |
if: inputs.effector-storage == '' | |
run: echo "pkg=npm:@${{ github.repository_owner }}/effector-storage@${{ fromJson(steps.get_latest_version.outputs.data)[0].name }}" >> "$GITHUB_OUTPUT" | |
- name: 📦 Use effector-storage version | |
id: use_effector_storage | |
run: echo "pkg=${{ inputs.effector-storage || steps.get_latest_package.outputs.pkg }}" >> "$GITHUB_OUTPUT" | |
- name: 🛎️ Checkout | |
uses: actions/checkout@v3 | |
- name: 📦 Use PNPM | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 8.10.2 | |
- name: 🐧 Use Node ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: pnpm | |
- name: 🔍 Install dependencies | |
run: pnpm install --frozen-lockfile --ignore-scripts | |
- name: ☄️ Install required effector and effector-storage dependencies | |
run: > | |
npm config set //npm.pkg.github.com/:_authToken $GITHUB_TOKEN && | |
pnpm remove effector && | |
pnpm add --save-exact --save-dev effector@$INPUT_EFFECTOR effector-storage@$INPUT_EFFECTOR_STORAGE | |
env: | |
INPUT_EFFECTOR: ${{ inputs.effector }} | |
INPUT_EFFECTOR_STORAGE: ${{ steps.use_effector_storage.outputs.pkg }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: ⛑️ Fix tests to use package instead of sources | |
run: > | |
find tests -type f -exec sed -i "s|'../src/types'|'effector-storage'|g" {} + && | |
find tests -type f -exec sed -i "s|'../../src|'effector-storage|g" {} + && | |
find tests -type f -exec sed -i "s|'../src|'effector-storage|g" {} + | |
- name: 🧪 Test | |
run: pnpm test-try | |
env: | |
INPUT_EFFECTOR: ${{ inputs.effector }} |