From 0ff3aec865d742c234b720ded122c01e006cac63 Mon Sep 17 00:00:00 2001 From: Sarmaged <3858245+Sarmaged@users.noreply.github.com> Date: Sat, 4 Jan 2025 00:28:49 +0300 Subject: [PATCH 1/2] ci: add workflow to auto-tag and update version on merge --- .github/workflows/notify.yml | 19 ------------------ .github/workflows/publish.yml | 28 --------------------------- .github/workflows/release.yml | 36 +++++++++++++++++++++++++++++------ 3 files changed, 30 insertions(+), 53 deletions(-) delete mode 100644 .github/workflows/notify.yml delete mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/notify.yml b/.github/workflows/notify.yml deleted file mode 100644 index 8d9124c..0000000 --- a/.github/workflows/notify.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: Notify - -on: - push: - branches: - - main - -jobs: - notify: - runs-on: ubuntu-latest - - steps: - - name: Send notification - run: | - curl -X POST \ - -H "Accept: application/vnd.github.v3+json" \ - -H "Authorization: token ${{ secrets.NOTIFY_GITHUB_TOKEN }}" \ - https://api.github.com/repos/Style-Forge/hub/dispatches \ - -d '{"event_type":"update-style-forge", "client_payload": {"package_name": "style-forge.base"}}' diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index abda8c1..0000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: Publish - -on: - push: - tags: - - '*.*.*' - -jobs: - publish: - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Set up Node.js - uses: actions/setup-node@v4 - with: - node-version: 20 - cache: yarn - - - name: Set up NPM auth - run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc - - - name: Publish to npm - run: yarn publish --non-interactive - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 224c691..6b1cca8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,7 +11,6 @@ permissions: jobs: release: - if: github.event.pull_request.merged == true runs-on: ubuntu-latest steps: @@ -24,22 +23,47 @@ jobs: node-version: 20 cache: yarn + - name: Configure Git + run: | + git config user.name "github-actions" + git config user.email "github-actions@github.com" + - name: Install dependencies run: yarn install --frozen-lockfile - - name: Extract version from package.json - id: extract_version + - name: Generate version from date + id: generate_version run: | - VERSION=$(jq -r '.version' package.json) + VERSION="v$(date +'%Y.%m.%d' | sed 's/0//g')" echo "VERSION=$VERSION" >> $GITHUB_ENV + echo "Generated version: $VERSION" + + - name: Update version in package.json + run: | + jq --arg new_version "${{ env.VERSION }}" '.version = $new_version' package.json > temp.json && mv temp.json package.json + echo "Updated package.json to version: ${{ env.VERSION }}" + + - name: Commit updated package.json + run: | + git add package.json + git commit -m "chore: update version to ${{ env.VERSION }}" + git push origin main - name: Create Git tag run: | - git tag -a "$VERSION" -m "Release $VERSION" - git push origin "$VERSION" + git tag -a "${{ env.VERSION }}" -m "Release ${{ env.VERSION }}" + git push origin "${{ env.VERSION }}" - name: Build the package run: yarn build - name: Notify release run: echo "Release ${{ env.VERSION }} has been successfully created." + + - name: Set up NPM auth + run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc + + - name: Publish to npm + run: yarn publish --non-interactive + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} From 3287aa89e55226b48bc92eab8c2daf0eb1a779e6 Mon Sep 17 00:00:00 2001 From: Sarmaged <3858245+Sarmaged@users.noreply.github.com> Date: Sat, 4 Jan 2025 01:11:31 +0300 Subject: [PATCH 2/2] ci: test release.yml and new release --- .github/workflows/release.yml | 22 ++++------------------ package.json | 2 +- 2 files changed, 5 insertions(+), 19 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6b1cca8..66bf5f1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -31,23 +31,12 @@ jobs: - name: Install dependencies run: yarn install --frozen-lockfile - - name: Generate version from date - id: generate_version + - name: Extract version from package.json + id: extract_version run: | - VERSION="v$(date +'%Y.%m.%d' | sed 's/0//g')" + VERSION=$(jq -r '.version' package.json) echo "VERSION=$VERSION" >> $GITHUB_ENV - echo "Generated version: $VERSION" - - - name: Update version in package.json - run: | - jq --arg new_version "${{ env.VERSION }}" '.version = $new_version' package.json > temp.json && mv temp.json package.json - echo "Updated package.json to version: ${{ env.VERSION }}" - - - name: Commit updated package.json - run: | - git add package.json - git commit -m "chore: update version to ${{ env.VERSION }}" - git push origin main + echo "Extracted version: $VERSION" - name: Create Git tag run: | @@ -57,9 +46,6 @@ jobs: - name: Build the package run: yarn build - - name: Notify release - run: echo "Release ${{ env.VERSION }} has been successfully created." - - name: Set up NPM auth run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc diff --git a/package.json b/package.json index 37e2a46..4931a56 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "style-forge.base", - "version": "5.3.6", + "version": "2025.1.4", "description": "Style-Forge.Base: foundational CSS variables, base styles, typography, colors, utilities for consistent design.", "type": "module", "main": "base.css",