From f4a9d0c2f4ba2b8eae9581a6022284f425378058 Mon Sep 17 00:00:00 2001 From: maphel <79743699+maphel@users.noreply.github.com> Date: Mon, 4 Sep 2023 01:56:13 +0200 Subject: [PATCH 1/7] Update publish.yml --- .github/workflows/publish.yml | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 22a06a1..f4f41f5 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -53,14 +53,27 @@ jobs: run: npm publish --access public env: NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} + + update-master-to-tagged-version: + runs-on: ubuntu-latest + + steps: + - name: Checkout master + uses: actions/checkout@v2 + with: + ref: master - - name: Configure Git + - name: Update package.json on master run: | - git config --global user.email "${{ secrets.GIT_USER_EMAIL }}" - git config --global user.name "maphel" + VERSION=$(jq -r '.version' package.json) + echo "Updating package.json version on master to $VERSION" + jq ".version = \"$VERSION\"" package.json > package.temp.json + mv package.temp.json package.json - - name: Commit updated package.json + - name: Commit and push updated package.json on master run: | + git config --local user.email "${{ secrets.GIT_USER_EMAIL }}" + git config --local user.name "maphel" git add package.json - git commit -m "Update package.json version to ${{ env.VERSION }}" - git push origin HEAD:${{ github.ref }} + git commit -m "Update package.json version to $VERSION on master" + git push origin master From 1ce1d41c405668031e26dc1f3d767c733f3dd25e Mon Sep 17 00:00:00 2001 From: maphel <79743699+maphel@users.noreply.github.com> Date: Mon, 4 Sep 2023 01:59:20 +0200 Subject: [PATCH 2/7] Update and rename publish.yml to release.yml --- .github/workflows/{publish.yml => release.yml} | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) rename .github/workflows/{publish.yml => release.yml} (91%) diff --git a/.github/workflows/publish.yml b/.github/workflows/release.yml similarity index 91% rename from .github/workflows/publish.yml rename to .github/workflows/release.yml index f4f41f5..9528f3d 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/release.yml @@ -58,12 +58,12 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout master - uses: actions/checkout@v2 + - name: Checkout main + uses: actions/checkout@v3 with: - ref: master + ref: main - - name: Update package.json on master + - name: Update package.json on main run: | VERSION=$(jq -r '.version' package.json) echo "Updating package.json version on master to $VERSION" @@ -75,5 +75,5 @@ jobs: git config --local user.email "${{ secrets.GIT_USER_EMAIL }}" git config --local user.name "maphel" git add package.json - git commit -m "Update package.json version to $VERSION on master" - git push origin master + git commit -m "Update package.json version to $VERSION on main" + git push origin main From e3f9b254c3bf4c0c347bde5314de51eb0d62d3e3 Mon Sep 17 00:00:00 2001 From: maphel <79743699+maphel@users.noreply.github.com> Date: Mon, 4 Sep 2023 02:10:43 +0200 Subject: [PATCH 3/7] Update release.yml --- .github/workflows/release.yml | 32 ++++++++------------------------ 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9528f3d..9e5c1b3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,22 +27,7 @@ jobs: - name: Install dependencies run: yarn install --immutable - - - name: Extract version from latest Git tag - run: echo "Updating package.json version to latest tag" - - - name: Install jq - run: sudo apt-get install jq - - - name: Use version and add to package.json - run: | - TAG_NAME=$(git describe --tags $(git rev-list --tags --max-count=1)) - VERSION=${TAG_NAME#*v.} - jq ".version = \"$VERSION\"" package.json > package.temp.json - mv package.temp.json package.json - env: - VERSION: $VERSION - + - name: Build run: yarn build @@ -62,15 +47,14 @@ jobs: uses: actions/checkout@v3 with: ref: main - - - name: Update package.json on main + + - name: Extract version from latest Git tag run: | - VERSION=$(jq -r '.version' package.json) - echo "Updating package.json version on master to $VERSION" - jq ".version = \"$VERSION\"" package.json > package.temp.json - mv package.temp.json package.json - - - name: Commit and push updated package.json on master + TAG_NAME=$(git describe --tags $(git rev-list --tags --max-count=1)) + VERSION=${TAG_NAME#*v} + npm version $VERSION --no-git-tag-version + + - name: Commit and push updated package.json on main run: | git config --local user.email "${{ secrets.GIT_USER_EMAIL }}" git config --local user.name "maphel" From bf5bbe95c5d5024d9a79a08f8b90c8386b5185bc Mon Sep 17 00:00:00 2001 From: maphel <79743699+maphel@users.noreply.github.com> Date: Mon, 4 Sep 2023 02:15:27 +0200 Subject: [PATCH 4/7] Update release.yml --- .github/workflows/release.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9e5c1b3..31863e7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -name: Publish +name: Release on: push: @@ -48,10 +48,15 @@ jobs: with: ref: main - - name: Extract version from latest Git tag + - name: Extract version from latest Git tag or use default run: | - TAG_NAME=$(git describe --tags $(git rev-list --tags --max-count=1)) - VERSION=${TAG_NAME#*v} + TAG_NAME=$(git tag | tail -n 1) # Fetch the latest tag + if [ -z "$TAG_NAME" ]; then # Check if TAG_NAME is empty + echo "No tags found. Using default version 1.0.0." + VERSION="1.0.0" + else + VERSION=${TAG_NAME#*v} + fi npm version $VERSION --no-git-tag-version - name: Commit and push updated package.json on main From 1948c54dc5fc2e5a9afa9623aae0f824e1875f26 Mon Sep 17 00:00:00 2001 From: maphel Date: Mon, 4 Sep 2023 00:16:03 +0000 Subject: [PATCH 5/7] Update package.json version to on main --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 57d1a92..96ac424 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@maphel/classnames", - "version": "1.0.2", + "version": "1.0.0", "description": "A utility for generating class names", "main": "./dist/index.js", "types": "./dist/index.d.ts", From bcc4529e9509ee12a0871c246d00ca08361bcba8 Mon Sep 17 00:00:00 2001 From: maphel <79743699+maphel@users.noreply.github.com> Date: Mon, 4 Sep 2023 02:18:37 +0200 Subject: [PATCH 6/7] Update release.yml --- .github/workflows/release.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 31863e7..047b042 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -47,6 +47,10 @@ jobs: uses: actions/checkout@v3 with: ref: main + fetch-depth: 0 + + - name: Fetch tags + run: git fetch --tags - name: Extract version from latest Git tag or use default run: | From f653a47454dcc29aecd900b0ac40601d03cb392d Mon Sep 17 00:00:00 2001 From: maphel Date: Mon, 4 Sep 2023 00:19:18 +0000 Subject: [PATCH 7/7] Update package.json version to on main --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 96ac424..dc8a71f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@maphel/classnames", - "version": "1.0.0", + "version": "1.0.9", "description": "A utility for generating class names", "main": "./dist/index.js", "types": "./dist/index.d.ts",