Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 15 additions & 18 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -15,7 +18,6 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.release.tag_name }}
fetch-depth: 0

- name: Setup Node
Expand All @@ -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 }}
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Loading