From 2ab15553b08cc288c6f9a22b13edbb124162ced4 Mon Sep 17 00:00:00 2001 From: Marko Zabreznik Date: Tue, 14 May 2024 18:33:50 +0200 Subject: [PATCH] v4.3.0 --- .github/workflows/publish.yml | 6 ++++-- package.json | 7 ++++--- scripts/publish.sh | 21 +++++++++++++++++++++ yarn.lock | 2 +- 4 files changed, 30 insertions(+), 6 deletions(-) create mode 100755 scripts/publish.sh diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 0bbbf45..28c7cf7 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,13 +1,15 @@ name: Publish to NPM on: push: - branches: - - 'v4.*' + tags: + - v4.* jobs: build: runs-on: ubuntu-latest + environment: v4 steps: - uses: actions/checkout@v4 + - run: corepack enable - uses: actions/setup-node@v4 with: node-version: '20.13.1' diff --git a/package.json b/package.json index c1167c9..33f1841 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "@povio/ecs-deploy-cli", "version": "4.3.0", "bin": { - "ecs-deploy": "./dist/sh.js" + "ecs-deploy": "dist/sh.js" }, "scripts": { "start": "tsx ./src/sh.ts", @@ -13,7 +13,8 @@ "build:clean": "rm -rf ./dist", "build": "yarn build:clean && node ./esbuild.mjs && chmod +x ./dist/sh.js", "build:check": "yarn tsc --project . --noEmit", - "lint": "eslint --fix" + "lint": "eslint --fix", + "push": "yarn exec ./scripts/publish.sh" }, "files": [ "dist", @@ -29,7 +30,7 @@ "homepage": "https://github.com/povio/ecs-deploy-cli", "bugs": "https://github.com/povio/ecs-deploy-cli/issues", "repository": { - "url": "https://github.com/povio/ecs-deploy-cli", + "url": "git+https://github.com/povio/ecs-deploy-cli.git", "type": "git" }, "author": "Marko Zabreznik ", diff --git a/scripts/publish.sh b/scripts/publish.sh new file mode 100755 index 0000000..94f2394 --- /dev/null +++ b/scripts/publish.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +set -e + +# check if the working directory is clean +if [ -n "$(git status --porcelain)" ]; then + echo "Working directory not clean. Please commit all changes before publishing." + exit 1 +fi + +# read version from package.json +VERSION=$(node -p -e "require('./package.json').version") + +# create a new git tag or error out if the tag already exists +git tag -a v$VERSION -m "v$VERSION" + +echo "Publishing version: v$VERSION" + +read -p "Press enter to continue" + +git push origin v4 "v$VERSION" diff --git a/yarn.lock b/yarn.lock index 8ecbd19..f544a79 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1268,7 +1268,7 @@ __metadata: yargs: "npm:^17.7.2" zod: "npm:^3.23.8" bin: - ecs-deploy: ./dist/sh.js + ecs-deploy: dist/sh.js languageName: unknown linkType: soft