Skip to content

Update workflow version checking #3

Update workflow version checking

Update workflow version checking #3

Workflow file for this run

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 "::set-output name=version::$(npm show $(jq -r '.name' packages/s2ts/package.json) version)"
- name: Get current non published version
id: get-non-published-version
run: echo "::set-output name=version-changed::$(jq -r '.version' packages/s2ts/package.json)"
- name: Publish to npm
if: steps.get-non-published-version.outputs.version != steps.get-published-version.outputs.version
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 "::set-output name=version::$(npm show $(jq -r '.name' packages/create-s2ts/package.json) version)"
- name: Get current non published version
id: get-non-published-version
run: echo "::set-output name=version-changed::$(jq -r '.version' packages/create-s2ts/package.json)"
- name: Publish to npm
if: steps.get-non-published-version.outputs.version != steps.get-published-version.outputs.version
run: npm run publish-npm
working-directory: packages/create-s2ts
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}