Skip to content

Commit 8a37ee3

Browse files
authored
Merge pull request #48 from humanmade/build-modernization
Build modernization
2 parents 47f4b73 + 059a248 commit 8a37ee3

File tree

10 files changed

+29125
-8695
lines changed

10 files changed

+29125
-8695
lines changed

.github/workflows/build.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Build to "release" branch
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref_name }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
release:
14+
name: "Update release branch"
15+
uses: humanmade/hm-github-actions/.github/workflows/build-and-release-node.yml@04c32a93e52ae987095f144105745a501d6207c8 # v0.2.0
16+
with:
17+
node_version: 24
18+
source_branch: main
19+
release_branch: release
20+
built_asset_paths: build

.github/workflows/release.yml

Lines changed: 0 additions & 31 deletions
This file was deleted.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Tag and Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Version tag (e.g., v1.0.0)'
8+
required: true
9+
target_branch:
10+
description: 'Branch to tag (e.g., release)'
11+
default: release
12+
required: true
13+
14+
jobs:
15+
tag_and_release:
16+
name: Tag and Release
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
22+
23+
- name: Check if tag already exists
24+
id: check_tag
25+
run: |
26+
if git rev-parse "refs/tags/${{ github.event.inputs.version }}" >/dev/null 2>&1; then
27+
echo "Tag already exists"
28+
echo "tag_exists=true" >> "$GITHUB_OUTPUT"
29+
fi
30+
31+
- name: Abort if tag exists
32+
if: steps.check_tag.outputs.tag_exists == 'true'
33+
run: exit 1
34+
35+
- name: Create and push tag
36+
run: |
37+
git config user.name "github-actions[bot]"
38+
git config user.email "github-actions[bot]@users.noreply.github.com"
39+
git fetch origin ${{ github.event.inputs.target_branch }}
40+
git checkout ${{ github.event.inputs.target_branch }}
41+
git tag ${{ github.event.inputs.version }}
42+
git push origin ${{ github.event.inputs.version }}
43+
44+
- name: Create GitHub Release
45+
uses: ncipollo/release-action@b7eabc95ff50cbeeedec83973935c8f306dfcd0b # v1.20.0
46+
with:
47+
tag: ${{ github.event.inputs.version }}
48+
name: ${{ github.event.inputs.version }}
49+
body: "Automated release of version ${{ github.event.inputs.version }}"
50+
draft: false
51+
prerelease: false
52+
token: ${{ secrets.GITHUB_TOKEN }}

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v12
1+
v24

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,14 @@ The tasks column appears after the title column by default on supported post typ
141141

142142
To change which column the tasks column appears after use the `altis.publication-checklist.show_tasks_after_column` filter and return the desired column slug such as `title`, `author` or `tags` for example.
143143

144+
## Release Process
145+
146+
Merges to `main` will automatically build to the `release` branch.
147+
148+
Commits in the `release` branch may be tagged by [running the Tag and Release workflow with the desired tag value](https://github.com/humanmade/publication-checklist/actions/workflows/tag-and-release.yml), then marked as releases in GitHub for download.
149+
150+
Tagging releases allows for installation via [packagist](https://packagist.org/packages/humanmade/hm-mega-menu-block) and [composer](http://getcomposer.org/). A project may also be set up to track the `dev-release` branch to use the latest built beta versions in between tagged releases.
151+
144152

145153
## License
146154

babel.config.js

Lines changed: 0 additions & 8 deletions
This file was deleted.

inc/namespace.php

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* Bootstrap.
1616
*/
1717
function bootstrap() {
18-
add_action( 'wp_enqueue_editor', __NAMESPACE__ . '\\enqueue_assets' );
18+
add_action( 'enqueue_block_editor_assets', __NAMESPACE__ . '\\enqueue_assets' );
1919
add_action( 'rest_api_init', __NAMESPACE__ . '\\register_rest_fields' );
2020
add_action( 'plugins_loaded', __NAMESPACE__ . '\\set_up_checks' );
2121
add_action( 'manage_posts_columns', __NAMESPACE__ . '\\register_column' );
@@ -57,27 +57,19 @@ function should_block_publish() {
5757
* Enqueue browser assets for the editor.
5858
*/
5959
function enqueue_assets() {
60-
// Ensure this screen is using the block editor.
61-
if ( ! wp_script_is( 'wp-block-editor', 'enqueued' ) ) {
62-
return;
63-
}
60+
$asset_file = include plugin_dir_path( __DIR__ ) . 'build/index.asset.php';
6461

6562
wp_enqueue_script(
6663
SCRIPT_ID,
6764
plugins_url( 'build/index.js', __DIR__ ),
68-
[
69-
'wp-block-editor',
70-
'wp-edit-post',
71-
'wp-plugins',
72-
'lodash',
73-
],
74-
VERSION
65+
$asset_file['dependencies'],
66+
$asset_file['version']
7567
);
7668
wp_enqueue_style(
7769
'workflow-pub-checklist',
78-
plugins_url( 'build/style.css', __DIR__ ),
70+
plugins_url( 'build/style-index.css', __DIR__ ),
7971
[],
80-
VERSION
72+
$asset_file['version']
8173
);
8274

8375
wp_localize_script( SCRIPT_ID, 'altisPublicationChecklist', [

0 commit comments

Comments
 (0)