Skip to content

Migrating from NPM to github packages #65

Migrating from NPM to github packages

Migrating from NPM to github packages #65

Workflow file for this run

name: Publish package to NPM
on:
push:
branches:
- main
- migrate_github
jobs:
generate_matrix:
name: Find services
runs-on: ubuntu-latest
outputs:
folders: ${{ steps.generate_matrix.outputs.folders }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Generate matrix
id: generate_matrix
shell: bash
run: |
cd ./packages
folders=$(tree -J -d -L 1 | jq -c '.[0].contents | map(.name)')
echo $folders
echo "folders=$folders" >> $GITHUB_OUTPUT
publish:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
needs: [ generate_matrix ]
strategy:
matrix:
folder: ${{ fromJson(needs.generate_matrix.outputs.folders) }}
defaults:
run:
working-directory: ./packages/${{ matrix.folder }}
steps:
-
name: Checkout repository
uses: actions/checkout@v3
# Setup .npmrc file to publish to GitHub Packages
-
name: Setup .npmrc
uses: actions/setup-node@v3
with:
node-version: '18.x'
registry-url: https://npm.pkg.github.com/
-
name: Install dependencies
run: yarn install --frozen-lockfile
-
name: Build TypeScript
run: yarn tsc
-
name: Build packages
run: yarn build
-
name: Publish package to NPM
run: yarn publish
continue-on-error: true
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}