Publish 1.0.10 to npm #70
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 packages on merge to main" | |
on: | |
pull_request: | |
types: | |
- closed | |
jobs: | |
merged: | |
if: github.event.pull_request.merged == true && !(startsWith(github.event.pull_request.head.ref, 'dependabot/')) | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '18.x' | |
registry-url: 'https://registry.npmjs.org' | |
- name: Install jq | |
uses: dcarbone/[email protected] | |
- name: Configure git identity | |
run: | | |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config --global user.name "Userfront Robot" | |
- run: npm ci | |
- run: npm run build:package | |
- name: Get dist-tag name | |
id: dist-tag | |
env: | |
BRANCH: "${{ github.event.pull_request.head.ref }}" | |
run: | | |
if [[ $BRANCH == release/* ]]; then | |
echo "NAME=latest" >> "$GITHUB_OUTPUT" | |
else | |
echo "NAME=alpha" >> "$GITHUB_OUTPUT" | |
fi | |
- run: npm publish -w package --tag ${{ steps.dist-tag.outputs.NAME }} --access=public | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Get package version | |
id: version | |
run: | | |
npm pkg get version -ws | jq -r '."@userfront/toolkit"' | xargs -0 -L1 -I '%' echo "VERSION=%" >> "$GITHUB_OUTPUT" | |
- uses: actions/github-script@v6 | |
with: | |
script: | | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: 'Published version ${{ steps.version.outputs.VERSION }} to npm.' | |
}) |