Update workflow to build instead of publish #56
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: Publish package to NPM | |
on: | |
push: | |
branches: | |
- main | |
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 "::set-output name=folders::$folders" | |
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://registry.npmjs.org' | |
# Defaults to the user or organization that owns the workflow file | |
scope: '@premise' | |
- | |
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.NPM_TOKEN }} |