Skip to content

Commit

Permalink
Create GitHub actions workflow for automatic publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
acelaya committed Jan 24, 2024
1 parent 444f6a6 commit 0b496f0
Show file tree
Hide file tree
Showing 12 changed files with 57 additions and 141 deletions.
7 changes: 4 additions & 3 deletions .distignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
.distignore
.editorconfig
.git
.github
.gitignore
.travis.yml
bin
builds
composer.json
composer.lock
docker-compose.yml
node_modules
package.json
package-lock.json
phpcs.xml
vendor
25 changes: 25 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Publish
concurrency:
group: ${{ github.event.repository.name }}-deploy
cancel-in-progress: true
on:
release:
types:
- published
jobs:
publish-wp-plugin:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Make language files
shell: bash
run: |
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
php wp-cli.phar i18n make-pot . "languages/hypothesis.pot"
- name: Publish WordPress Plugin
uses: 10up/action-wordpress-plugin-deploy@stable
env:
SVN_USERNAME: ${{ secrets.WP_SVN_USERNAME }}
SVN_PASSWORD: ${{ secrets.WP_SVN_PASSWORD }}
SLUG: hypothesis
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
builds
node_modules
vendor
wp-cli*
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# [hypothes.is](http://hypothes.is/) for WordPress

Stable versions are available on the
[Hypothesis plugin page on WordPress.org](https://wordpress.org/plugins/hypothesis/).
Stable versions are available on the [Hypothesis plugin page on WordPress.org](https://wordpress.org/plugins/hypothesis/).

## Install Directions

Expand All @@ -14,7 +13,19 @@ Stable versions are available on the

## Publishing

New releases are automatically published to WordPress.org via Travis CI (using [this script](bin/deploy.sh)) whenever the version in [hypothesis.php](hypothesis.php) is incremented and a new version is tagged. Translation files will be updated as well. This method is largely based on the process described by [Iain Poulson](https://github.com/polevaultweb) in [this blog post](https://deliciousbrains.com/deploying-wordpress-plugins-travis/), and also makes use of the [wp-cli](https://wp-cli.org) `i18n` command.
Follow these steps to publish a new plugin version.

1. **Update the package version** in `hypothesis.php`, `readme.txt` and `package.json`, and merge that change into the `main` branch[^1]. We use [Semantic Versioning](https://semver.org/#semantic-versioning-200).
2. **Create a tag** pointing at the version-change commit and generate a **new GitHub release** (details follow). Publishing a GitHub release will kick off a GitHub Action that will publish the plugin to wordpress.org

### Creating a GitHub release

Create a [new GitHub release](https://github.com/hypothesis/frontend-shared/releases/new/) with these values:

1. _Tag_: Create a new tag for the release, targeting the `main` branch (your just-merged version bump should be at the tip)[^2]. The tag should match the version number, e.g. `v5.2.1`.
2. _Title_: Use the tag name.
3. Click the `Auto-generate release notes` button to generate release notes and edit as needed. We use [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) formatting.[^3]
4. Leave other fields alone/as defaults.

## License

Expand Down
15 changes: 0 additions & 15 deletions bin/build.sh

This file was deleted.

98 changes: 0 additions & 98 deletions bin/deploy.sh

This file was deleted.

7 changes: 0 additions & 7 deletions bin/get_plugin_version.php

This file was deleted.

2 changes: 1 addition & 1 deletion hypothesis.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Plugin URI: https://hypothes.is/
* Description: Hypothesis is an open platform for the collaborative evaluation of knowledge. This plugin embeds the necessary scripts in your WordPress site to enable any user to use Hypothesis without installing any extensions.
* Version: 0.6.0
* Requires at least: 6.0
* Requires at least: 6.2
* Requires PHP: 7.4
* Author: The Hypothesis Project and contributors
* Author URI: https://hypothes.is/
Expand Down
2 changes: 1 addition & 1 deletion license.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2013-2016 Hypothes.is Project and contributors
Copyright (c) 2013-2024 Hypothes.is Project and contributors

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hypothesis",
"version": "0.4.8",
"version": "0.6.0",
"main": "Gruntfile.js",
"author": "The Hypothesis Project and contributors",
"repository": "http://github.com/hypothesis/wp-hypothesis/",
Expand Down
16 changes: 7 additions & 9 deletions phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,16 @@

<!-- Show colors in console -->
<arg value="-colors"/>
<!-- Do not print warnings -->
<!-- Do not print warnings -->
<arg value="n"/>
<!-- Show sniff codes in all reports -->
<arg value="s"/>

<!-- Exclude bin -->
<exclude-pattern>bin/</exclude-pattern>
<!-- Exclude tests -->
<exclude-pattern>tests/</exclude-pattern>
<!-- Exclude vendor -->
<exclude-pattern>vendor/</exclude-pattern>
<!-- Exclude tests -->
<exclude-pattern>tests/</exclude-pattern>
<!-- Exclude vendor -->
<exclude-pattern>vendor/</exclude-pattern>

<!-- WordPress Coding Standards -->
<rule ref="WordPress-Extra" />
<!-- WordPress Coding Standards -->
<rule ref="WordPress-Extra" />
</ruleset>
6 changes: 3 additions & 3 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
=== Plugin Name ===
Contributors: timmmmyboy, BigBlueHat, JakeHartnell, greatislander
Contributors: timmmmyboy, BigBlueHat, JakeHartnell, greatislander, acelaya
Tags: hypothesis, annotation, comments
Requires at least: 3.7
Tested up to: 5.2.2
Requires at least: 6.2
Tested up to: 6.4.2
Stable tag: 0.6.0
License: BSD
License URI: http://opensource.org/licenses/BSD-2-Clause
Expand Down

0 comments on commit 0b496f0

Please sign in to comment.