diff --git a/.gitattributes b/.gitattributes index e63111b..743e241 100644 --- a/.gitattributes +++ b/.gitattributes @@ -5,3 +5,4 @@ /.gitattributes export-ignore /.gitignore export-ignore /README.md export-ignore +/.wordpress-org export-ignore diff --git a/.github/workflows/wporg-deploy.yml b/.github/workflows/wporg-deploy.yml new file mode 100644 index 0000000..603ff0a --- /dev/null +++ b/.github/workflows/wporg-deploy.yml @@ -0,0 +1,86 @@ +# Publishes the plugin to the WordPress.org directory +# (https://wordpress.org/plugins/hibira/) over SVN. +# +# - trunk/ <- git archive of this commit (export-ignore rules apply) +# - tags// <- copy of trunk, = Version in hibira.php +# - assets/ <- .wordpress-org/ (banners, icons, screenshots) +# +# Runs when a GitHub Release is published (tag v), or by hand from +# the Actions tab. The SVN password lives in the SVN_PASSWORD repository +# secret (WordPress.org profile → Account & Security → SVN password). +name: wporg-deploy +on: + release: + types: [published] + workflow_dispatch: + inputs: + dry_run: + description: Build and show the SVN changes without committing + type: boolean + default: false + +permissions: + contents: read + +concurrency: wporg-deploy + +env: + SLUG: hibira + SVN_URL: https://plugins.svn.wordpress.org/hibira + SVN_USERNAME: hibira + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Versions agree + id: version + run: | + version="$(sed -n 's/^ \* Version: *//p' hibira.php)" + stable="$(sed -n 's/^Stable tag: *//p' readme.txt)" + [ "$version" = "$stable" ] || { echo "hibira.php $version != readme Stable tag $stable"; exit 1; } + if [ "$GITHUB_EVENT_NAME" = release ]; then + [ "v$version" = "$GITHUB_REF_NAME" ] || { echo "tag $GITHUB_REF_NAME != v$version"; exit 1; } + fi + echo "version=$version" >> "$GITHUB_OUTPUT" + + - name: Install Subversion + run: command -v svn || { sudo apt-get update -qq && sudo apt-get install -y -qq subversion; } + + - name: Stage trunk, tag and assets + env: + VERSION: ${{ steps.version.outputs.version }} + run: | + svn checkout --depth immediates "$SVN_URL" svn + svn update --set-depth infinity svn/trunk svn/assets + mkdir build + git archive --format=tar HEAD | tar -x -C build + rsync -rc --delete --exclude=.svn build/ svn/trunk/ + rsync -rc --delete --exclude=.svn .wordpress-org/ svn/assets/ + cd svn + svn add --force trunk assets > /dev/null + svn status | awk '/^!/ {print $2}' | xargs -r svn delete + shopt -s nullglob + for f in assets/*.png; do svn propset -q svn:mime-type image/png "$f"; done + for f in assets/*.jpg; do svn propset -q svn:mime-type image/jpeg "$f"; done + if svn ls "$SVN_URL/tags/$VERSION" > /dev/null 2>&1; then + echo "::notice::tags/$VERSION already exists; updating trunk and assets only" + else + svn update -q --set-depth immediates tags + svn copy -q trunk "tags/$VERSION" + fi + svn status + + - name: Commit + if: ${{ !inputs.dry_run }} + working-directory: svn + env: + SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }} + VERSION: ${{ steps.version.outputs.version }} + run: | + [ -n "$SVN_PASSWORD" ] || { echo "SVN_PASSWORD secret is not set"; exit 1; } + svn commit -m "Release $VERSION" \ + --username "$SVN_USERNAME" --password "$SVN_PASSWORD" \ + --non-interactive --no-auth-cache diff --git a/.wordpress-org/banner-1544x500.png b/.wordpress-org/banner-1544x500.png new file mode 100644 index 0000000..ce5f178 Binary files /dev/null and b/.wordpress-org/banner-1544x500.png differ diff --git a/.wordpress-org/banner-772x250.png b/.wordpress-org/banner-772x250.png new file mode 100644 index 0000000..f23353a Binary files /dev/null and b/.wordpress-org/banner-772x250.png differ diff --git a/.wordpress-org/icon-128x128.png b/.wordpress-org/icon-128x128.png new file mode 100644 index 0000000..063d2bb Binary files /dev/null and b/.wordpress-org/icon-128x128.png differ diff --git a/.wordpress-org/icon-256x256.png b/.wordpress-org/icon-256x256.png new file mode 100644 index 0000000..8e106ee Binary files /dev/null and b/.wordpress-org/icon-256x256.png differ diff --git a/README.md b/README.md index e5b61ad..6f87be2 100644 --- a/README.md +++ b/README.md @@ -20,9 +20,10 @@ No Composer, no build step: the PHP side signs Hibira HTTP API calls itself ## Install -Until it is on WordPress.org: download `hibira.zip` from the -[latest release](https://github.com/hibira-io/wordpress/releases/latest), then -**Plugins → Add New → Upload Plugin**. Go to **Settings → Hibira**, paste the app ID, key +In wp-admin, **Plugins → Add New**, search for **Hibira Realtime** and install it +([wordpress.org/plugins/hibira](https://wordpress.org/plugins/hibira/)). Or download +`hibira.zip` from the [latest release](https://github.com/hibira-io/wordpress/releases/latest) +and use **Upload Plugin**. Go to **Settings → Hibira**, paste the app ID, key and secret from your app in the [Hibira portal](https://hibira.io/portal) (the free plan is enough) and press **Send a test event**. @@ -96,6 +97,15 @@ files: WordPress.org builds and delivers them from .po files for importing there; they are left out of the plugin zip. CI runs the tests on PHP 7.4–8.4, PHPCS and the WordPress Plugin Check. +## Release + +Bump `Version` in `hibira.php` and `Stable tag` in `readme.txt`, then publish a +GitHub Release tagged `v`. Two workflows run: `release` attaches +`hibira.zip`, and `wporg-deploy` commits the same files to the WordPress.org SVN +repo (`trunk/`, `tags//`, and `.wordpress-org/` → `assets/`). It needs +the `SVN_PASSWORD` repository secret. To update only the banner or icons, run +`wporg-deploy` by hand from the Actions tab. + ## License GPL-2.0-or-later, like WordPress. pusher-js (`assets/vendor`) is MIT.