Skip to content

Prototype for ROR using MUI/Synapse components #2134

Prototype for ROR using MUI/Synapse components

Prototype for ROR using MUI/Synapse components #2134

Workflow file for this run

name: 'NPM Publish and GitHub tag'
on:
push:
branches:
- main
pull_request:
branches: [main]
jobs:
tag-and-publish:
strategy:
matrix:
publishablePackage:
[
synapse-react-client,
markdown-it-synapse,
'@sage-bionetworks/markdown-it-container',
'@sage-bionetworks/synapse-types',
]
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: ./.github/actions/pnpm-setup-action
- name: Get package path
id: package-path
run: |
packagePath=$(pnpm nx show project ${{ matrix.publishablePackage }} --json | jq -r '.sourceRoot')
echo "packagePath=${packagePath}" >> "$GITHUB_OUTPUT"
# Check if the package version changed
- id: package-version-check
uses: EndBug/version-check@v2
with:
diff-search: true
file-name: './${{ steps.package-path.outputs.packagePath }}/package.json'
# Build the package to publish
- name: Build package
run: pnpm nx run ${{ matrix.publishablePackage }}:build
# If the package version changed, and the build succeeded, create the tag using the output of the previous step.
- name: Create tag
uses: actions/github-script@v6
if: github.event_name == 'push' && steps.package-version-check.outputs.changed == 'true'
with:
github-token: ${{ github.token }}
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "refs/tags/${{ matrix.publishablePackage }}/v${{ steps.package-version-check.outputs.version }}",
sha: context.sha
})
- name: Publish to NPM # or simulate the publish for PRs
run: pnpm publish --access public ${{ ((github.event_name == 'pull_request' || steps.package-version-check.outputs.changed == 'false') && '--dry-run --no-git-checks') || '' }}
working-directory: './${{ steps.package-path.outputs.packagePath }}'
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}