README.md 1.71 KB
Newer Older
Erick Hitter's avatar
Erick Hitter committed
1
# WP.org Plugin Deploy [![pipeline status](https://git.ethitter.com/open-source/wp-org-plugin-deploy/badges/master/pipeline.svg)](https://git.ethitter.com/open-source/wp-org-plugin-deploy/commits/master)
Erick Hitter's avatar
Erick Hitter committed
2

Erick Hitter's avatar
Erick Hitter committed
3 4 5 6
Deploy plugin updates to WordPress.org's plugin SVN. Modeled on [10up's GitHub action](https://github.com/10up/actions-wordpress/blob/598b1572d5024340f09d7efc083a65ebff3bcdef/dotorg-plugin-deploy/entrypoint.sh) of the same intent.

## Configuration

Erick Hitter's avatar
Erick Hitter committed
7 8 9
1. Add the `.gitlab-ci.yml` configuration described below.
1. Set the environment variables in the GitLab project.

Erick Hitter's avatar
Erick Hitter committed
10 11 12 13 14 15 16 17 18 19 20
### `.gitlab-ci.yml`

Add the following to the plugin's `.gitlab-ci.yml`:

```yaml
PluginSVN:
  stage: deploy
  image: containers.ethitter.com:443/docker/images/php:7.3
  before_script:
    - apt-get update
    - apt-get install -y rsync
Erick Hitter's avatar
Erick Hitter committed
21 22
    - curl -o ./bin/deploy.sh https://git-cdn.e15r.co/open-source/wp-org-plugin-deploy/raw/master/scripts/deploy.sh
    - chmod +x ./bin/deploy.sh
Erick Hitter's avatar
Erick Hitter committed
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
  script: ./bin/deploy.sh
  when: on_success
```

While unnecessary, if you'd rather save the time of testing the deploy, append the following to the CI job's configuration:

```yaml
only:
  - master
```

The above is a time-save only; the build script exits before the `svn commit` stage if the merge isn't into `master`. 

### CI Environment Variables

Set the following environment variables in the GitLab project's configuration:

Erick Hitter's avatar
Erick Hitter committed
40
* `WP_ORG_USERNAME`
Erick Hitter's avatar
Erick Hitter committed
41 42 43
* `WP_ORG_PASSWORD`
* `PLUGIN_SLUG` - plugin's name on WordPress.org
* `PLUGIN_VERSION` - version to tag
Erick Hitter's avatar
Erick Hitter committed
44
* `WP_ORG_RELEASE_REF` - git commit ref (branch or tag) to use for release 
Erick Hitter's avatar
Erick Hitter committed
45 46 47 48

### Alternatives

A [loader script](./scripts/loader.sh) is available as an alternative to downloading the deploy script during the `before_script` stage.