Add better logging and error handling #15
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 to npm | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'packages/s2ts/package.json' | |
- 'packages/create-s2ts/package.json' | |
jobs: | |
publish-s2ts: | |
name: Publish s2ts | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
registry-url: 'https://registry.npmjs.org' | |
- name: Install dependencies | |
run: npm install | |
working-directory: packages/s2ts | |
- name: Get current published version | |
id: get-published-version | |
run: echo "version-published=$(npm show $(jq -r '.name' packages/s2ts/package.json) version)" >> $GITHUB_OUTPUT | |
- name: Get current non published version | |
id: get-non-published-version | |
run: echo "version-non-published=$(jq -r '.version' packages/s2ts/package.json)" >> $GITHUB_OUTPUT | |
- name: Print versions | |
id: print-versions | |
run: | | |
echo "Published version: ${{ steps.get-published-version.outputs.version-published }}" | |
echo "Non published version: ${{ steps.get-non-published-version.outputs.version-non-published }}" | |
- name: Publish to npm | |
if: steps.get-non-published-version.outputs.version-non-published != steps.get-published-version.outputs.version-published | |
run: npm run publish-npm | |
working-directory: packages/s2ts | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
publish-create-s2ts: | |
name: Publish create s2ts | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
registry-url: 'https://registry.npmjs.org' | |
- name: Install dependencies | |
run: npm install | |
working-directory: packages/create-s2ts | |
- name: Get current published version | |
id: get-published-version | |
run: echo "version-published=$(npm show $(jq -r '.name' packages/create-s2ts/package.json) version)" >> $GITHUB_OUTPUT | |
- name: Get current non published version | |
id: get-non-published-version | |
run: echo "version-non-published=$(jq -r '.version' packages/create-s2ts/package.json)" >> $GITHUB_OUTPUT | |
- name: Print versions | |
id: print-versions | |
run: | | |
echo "Published version: ${{ steps.get-published-version.outputs.version-published }}" | |
echo "Non published version: ${{ steps.get-non-published-version.outputs.version-non-published }}" | |
- name: Publish to npm | |
if: steps.get-non-published-version.outputs.version-non-published != steps.get-published-version.outputs.version-published | |
run: npm run publish-npm | |
working-directory: packages/create-s2ts | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |