diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 529d9cd..8c1998f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,9 +1,12 @@ name: Version and Release on: - release: - types: - - created + workflow_dispatch: + inputs: + version: + description: 'Version number to release (e.g. 1.2.3, without a leading "v")' + required: true + type: string permissions: contents: write @@ -15,7 +18,6 @@ jobs: - name: Checkout uses: actions/checkout@v4 with: - ref: ${{ github.event.release.tag_name }} fetch-depth: 0 - name: Setup Node @@ -27,33 +29,28 @@ jobs: - name: Install dependencies run: npm i - - name: Get version from tag - id: version - run: echo "version=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT - - name: Update version in plugin file - run: sed -i "s/__VERSION__/${{ steps.version.outputs.version }}/g" hubspot-form-block.php + run: sed -i "s/__VERSION__/${{ inputs.version }}/g" hubspot-form-block.php - name: Build run: npm run build - - name: Commit version update + - name: Create tag run: | git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" git add . - git commit -m "Update version to ${{ steps.version.outputs.version }}" - - - name: Update tag - run: | - git tag -f ${{ github.event.release.tag_name }} - git push origin ${{ github.event.release.tag_name }} --force + git commit -m "Update version to ${{ inputs.version }}" + git tag "v${{ inputs.version }}" + git push origin "v${{ inputs.version }}" - name: Create plugin ZIP run: npm run plugin-zip - - name: Upload release asset + - name: Create GitHub Release run: | - gh release upload ${{ github.event.release.tag_name }} hubspot-form-block.zip --clobber + gh release create "v${{ inputs.version }}" hubspot-form-block.zip \ + --title "v${{ inputs.version }}" \ + --generate-notes env: GH_TOKEN: ${{ github.token }} diff --git a/CLAUDE.md b/CLAUDE.md index 0863184..ab05bfb 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -55,7 +55,7 @@ The `--webpack-copy-php` flag on `build`/`start` is required — it copies `rend ## Release workflow 1. Push to `main` → `build-and-release.yml` automatically merges built `build/` into the `release` branch. -2. Create a GitHub Release with a semver tag → `release.yml` replaces `__VERSION__` placeholder in `hubspot-form-block.php`, commits, retags, and uploads `hubspot-form-block.zip`. +2. Manually run the `Version and Release` workflow (`release.yml`) via `workflow_dispatch`, passing the version number (e.g. `1.2.3`, no leading `v`) → it replaces the `__VERSION__` placeholder in `hubspot-form-block.php`, builds, creates the `v{version}` tag, and creates a GitHub Release with `hubspot-form-block.zip` attached. No retag/force-push — the tag is created fresh from the version-bumped build. ## Test credentials diff --git a/README.md b/README.md index 4545e59..c8dd389 100644 --- a/README.md +++ b/README.md @@ -84,4 +84,4 @@ hubspot-form-block.php # Plugin entry: block registration, script enqueue, sett ## Release workflow 1. Push to `main` → `build-and-release.yml` automatically merges built `build/` into the `release` branch. -2. Create a GitHub Release with a semver tag → `release.yml` replaces the `__VERSION__` placeholder in `hubspot-form-block.php`, commits, retags, and uploads `hubspot-form-block.zip`. +2. Manually run the **Version and Release** workflow (`release.yml`) from the Actions tab (`workflow_dispatch`), entering the version number (e.g. `1.2.3`, without a leading `v`). It replaces the `__VERSION__` placeholder in `hubspot-form-block.php`, builds, creates the `v{version}` tag, and publishes a GitHub Release with `hubspot-form-block.zip` attached. The tag is created fresh from the version-bumped build — no retag or force-push.