diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a560294..e9f0d1c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,8 +4,13 @@ on: push: branches: [main] +concurrency: + group: release + cancel-in-progress: false + permissions: contents: write + id-token: write jobs: release: @@ -16,6 +21,11 @@ jobs: with: fetch-depth: 0 + - uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 + with: + node-version: 24 + registry-url: https://registry.npmjs.org + - name: Get version from package.json id: version run: | @@ -32,6 +42,21 @@ jobs: echo "exists=false" >> "$GITHUB_OUTPUT" fi + - name: Check if version is already on npm + id: check_npm + run: | + if npm view "@mimo-3/slack-cli@${{ steps.version.outputs.version }}" version >/dev/null 2>&1; then + echo "published=true" >> "$GITHUB_OUTPUT" + else + echo "published=false" >> "$GITHUB_OUTPUT" + fi + + - name: Publish to npm + if: steps.check_npm.outputs.published == 'false' + run: | + npm ci + npm publish + - name: Create GitHub Release if: steps.check_tag.outputs.exists == 'false' uses: softprops/action-gh-release@153bb8e04406b158c6c84fc1615b65b24149a1fe # v2.6.1 diff --git a/package.json b/package.json index 50215a3..05695ff 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@mimo-3/slack-cli", - "version": "0.22.1", + "version": "0.22.2", "description": "A command-line tool for sending messages to Slack", "main": "dist/index.js", "bin": {