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
Binary file added .github/docs/release-tagging-action.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions .github/workflows/build-release-branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Build to "release" branch

on:
push:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true

jobs:
release:
name: "Update release branch"
uses: humanmade/hm-github-actions/.github/workflows/build-and-release-node.yml@a9a243d6c42fbff4a967d7ce0a6b307bc77251b7 # v0.1.0
with:
node_version: 24
source_branch: main
release_branch: release
built_asset_paths: build build-vendor
51 changes: 51 additions & 0 deletions .github/workflows/tag-and-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Tag and Release

on:
workflow_dispatch:
inputs:
version:
description: 'Version tag (e.g., v1.0.0)'
required: true
target_branch:
description: 'Branch to tag (e.g., release)'
default: release
required: true

jobs:
tag_and_release:
name: Tag and Release
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1

- name: Check if tag already exists
id: check_tag
run: |
if git rev-parse "refs/tags/${{ github.event.inputs.version }}" >/dev/null 2>&1; then
echo "Tag already exists"
echo "tag_exists=true" >> "$GITHUB_OUTPUT"
fi

- name: Abort if tag exists
if: steps.check_tag.outputs.tag_exists == 'true'
run: exit 1

- name: Create and push tag
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git fetch origin ${{ github.event.inputs.target_branch }}
git checkout ${{ github.event.inputs.target_branch }}
git tag ${{ github.event.inputs.version }}
git push origin ${{ github.event.inputs.version }}

- name: Create GitHub Release
uses: ncipollo/release-action@b7eabc95ff50cbeeedec83973935c8f306dfcd0b # v1.20.0
with:
tag: ${{ github.event.inputs.version }}
name: ${{ github.event.inputs.version }}
body: "Automated release of version ${{ github.event.inputs.version }}"
draft: false
prerelease: false
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v24
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,33 @@ npm run build
npm start
```

## Release Process

Merges to `main` will automatically [build](https://github.com/humanmade/hm-color-palette/actions/workflows/build-release-branch.yml) to the `release` branch. A project may be set up to track the `release` branch using [composer](http://getcomposer.org/) to pull in the latest built beta version.

Commits on the `release` branch may be tagged for installation via [packagist](https://packagist.org/packages/humanmade/hm-color-palette) and marked as releases in GitHub for manual download using a [manually-dispatched "Tag and Release" GH Actions workflow](https://github.com/humanmade/hm-color-palette/actions/workflows/tag-and-release.yml).

To tag a new release,

1. Review the unreleased features in the [Changelog](./CHANGELOG.md) and choose the target version number for the next release using [semantic versioning](https://semver.org/)
2. Checkout a `prepare-v#.#.#` branch. In that branch,
- Add a new header into [CHANGELOG.md](./CHANGELOG.md) for any unreleased features
- Bump the version number in the [hm-color-palette.php](./hm-color-palette.php) file's PHPDoc header
3. Open a pull request from your branch titled "Prepare release v#.#.#"
4. Review and merge your "Prepare release" pull request
5. Wait for the `release` branch to [update](https://github.com/humanmade/hm-color-palette/actions/workflows/build-release-branch.yml) with the build that includes the new version number
6. On the ["Tag and Release" GH Action page](https://github.com/humanmade/hm-color-palette/actions/workflows/tag-and-release.yml)],
- Click the "Run workflow" button in the "workflow_dispatch" notification banner (see screenshot below)
- Fill out the "Version tag" field with your target version number
- This version must match the version in `hm-color-palette.php` and your newest Changelog section
- Use the format `v#.#.#` for your version tag
- Leave the "Branch to tag" field as `release` (we will add the tag on the release branch containing the latest built code)
- Click "Run workflow"

![Screenshot of Run workflow dropdown form being filled out](./.github/docs/release-tagging-action.jpg)

Once the workflow completes, your new version should be [tagged](https://github.com/humanmade/hm-carousel-block/tags) and available in the list of [releases](https://github.com/humanmade/hm-carousel-block/releases)

## Requirements

- WordPress 5.8+
Expand Down
Loading