Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
waynewyang committed Dec 10, 2023
1 parent 93efaee commit 2b033e7
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
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 "::set-output name=previous::$(git describe --tags --abbrev=0)"

# Get the current version from package.json
- name: Get current version
id: current_version
run: echo "::set-output name=current::$(node -p "require('./package.json').version")"

# 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

0 comments on commit 2b033e7

Please sign in to comment.