Skip to content

update

update #3

Workflow file for this run

name: Release on Version Change
on:
workflow_dispatch:
push:
branches: ["main"]
pull_request:
branches: ["main"]
jobs:
check-version:
runs-on: macos-latest
strategy:
matrix:
node-version: [18.x]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Checkout repository
uses: actions/checkout@v2
# Get the previous version from Git tags
- name: Get previous version
id: prev_version
run: echo "{previous}={$(git describe --tags --abbrev=0)}" >> $GITHUB_STATE
# Get the current version from package.json
- name: Get current version
id: current_version
run: echo "{current}={$(node -p "require('./package.json').version")}" >> $GITHUB_STATE
# Compare the previous and current versions
- name: Compare versions
run: |
if [ "${{ steps.current_version.outputs.current }}" != "${{ steps.prev_version.outputs.previous }}" ]; then
echo "Version has changed! Creating tag and publishing to npm..."
# Perform tag creation and npm publishing here
# Replace this comment with the actual commands
else
echo "No version change detected."
fi