Skip to content

Commit

Permalink
feat: add releases updater
Browse files Browse the repository at this point in the history
  • Loading branch information
sanderdekroon committed Mar 6, 2023
1 parent 5ee1a3e commit 14ffe1f
Show file tree
Hide file tree
Showing 10 changed files with 325 additions and 216 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Release

on:
push:
tags:
- '*'

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: php-actions/composer@v6
with:
# Lowest supported PHP version
php_version: "7.4"
- run: composer run package
- name: Release
uses: fnkr/github-action-ghr@v1
env:
GHR_COMPRESS: zip
GHR_PATH: releases/
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,4 @@ vendor
!/src/vendor

tests/coverage
releases
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## Version [3.7.0] (2023-03-??)

- Updates can now be provided through the Admin interface

## Version [3.6.4] (2023-02-09)

### Fix
Expand Down
88 changes: 46 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,47 +1,51 @@
# README
# Plugin OpenPDC Base

### OpenPDC base
This repository contains the the OpenwebConcept OpenPDC plugin.

Plugin to add the OpenwebConcept OpenPDC to your project.
## Installation

- Contributors: Yard | Digital Agency
- Requires at least: 4.8
- Tested up to: 5.4.2
- Requires PHP: 7.2
- Stable tag: 3.5.0
Before installation, make sure you install following required plugins:
- [RWMB Metabox](https://wordpress.org/plugins/meta-box/)
- [Posts 2 Posts](https://wordpress.org/plugins/posts-to-posts/)

### For users
1. Download the latest release from [the releases page](https://github.com/OpenWebconcept/plugin-pdc-base/releases)
2. Unzip and move all files to the `/wp-content/plugins/pdc-base` directory.
3. Log into the WordPress admin and activate the 'Yard | OpenPDC Base' plugin through the 'plugins' menu
4. Go to the 'PDC instellingen' pagina in the left-hand menu to enter some of the required settings

### How do I get set up?
### For developers
To contribute to this project, no dependencies are required. However, you will need to download [Composer](https://getcomposer.org/) to run tests or create an optimized build of the plugin.

- Unzip and/or move all files to the /wp-content/plugins/pdc-base directory
- Log into WordPress admin and activate the ‘PDC Base’ plugin through the ‘Plugins’ menu**
- Go to the 'PDC instellingen pagina' in the left-hand menu to enter some of the required settings
1. Clone this repository to your machine and/or WordPress installation
2. Optionally use Composer (`composer install`) to install the dev dependencies

### **Error(s)?
Where the activate 'PDCBase' plugin causes the following error
To create an optimized and zipped build, run the `composer run package` command. This requires `Composer`, `rsync` and `zip` to run.

### Activation error(s)?
When activating the 'PDCBase' plugin is causing the following error:

![activateplugin-error](./assets/images/pluginactivate-error.png)

just install the missing ones via:
Install the following required plugins:
- [RWMB Metabox](https://wordpress.org/plugins/meta-box/)
- [Posts 2 Posts](https://wordpress.org/plugins/posts-to-posts/)

In addition, you still have to install the extra dependencies with Composer. Depending on your setup, you do this by opening your terminal, navigating to the OpenPDC plugin folder and running `sudo -u www-data composer install` there.

Reactivating the plugin works fine now.
Activating the plugin after installation should fix the issue:

![pluginactivated](./assets/images/pluginactivated.png)

#### Additional Settings
### Additional Settings

On the 'PDC instellingen pagina' there are 2 settings optional for extending the slug used in the 'view in portal' url.
On the 'PDC instellingen' page there are 2 optional settings for extending the slug used in the 'view in portal' url.
The 'view in portal' button can be found in de wp-admin bar on the editor pages of the pdc-items or inside the 'quick edit' blocks on the overview page of pdc-items.
With these optional settings the theme and subtheme can be included into the 'view in portal' url.

Additionally, there is a possibility to use a fourth layer called 'pdc-groups'. The hierarchy, when the fourth layer setting is checked, is pdc-theme -> pdc-subtheme -> pdc-group -> pdc-item.

Finally, pdc-items can support multiple identifications for scheduling an appointment. Currently there are meta settings for DigiD, eHerkenning and eIDAS. You can set those values in the editor of a pdc-item.

### Connections
## Connections

Some connections between posttypes are required for the portal to work properly. The required connections and in the correct order when filling the website:

Expand All @@ -50,11 +54,11 @@ Some connections between posttypes are required for the portal to work properly.
3. pdc-group -> pdc-item, pdc-theme and pdc-subtheme (pdc-groups usage is optional)
4. pdc-item -> pdc-theme, pdc-subtheme

### Filters & Actions
## Filters & Actions

There are various [hooks](https://codex.wordpress.org/Plugin_API/Hooks), which allows for changing the output.

##### Action for changing main Plugin object.
### Action for changing main Plugin object.

```php
'owc/pdc-base/plugin'
Expand All @@ -72,86 +76,86 @@ Via the plugin object the following config settings can be adjusted
- settings_pages
- taxonomies

##### Filters the Posts to Posts connection defaults.
### Filters the Posts to Posts connection defaults.

```php
owc/pdc-base/p2p-connection-defaults
```

##### Filters the per Posts to Posts connection, connection type args.
### Filters the per Posts to Posts connection, connection type args.

```php
owc/pdc-base/before-register-p2p-connection/{$posttypes_from}/{$posttypes_to]}
```

##### Filters the data retrieved for this Rest API field.
### Filters the data retrieved for this Rest API field.

```php
owc/pdc-base/rest-api/pdcitem/field/get-links
```

##### Filters the data retrieved for this Rest API field.
### Filters the data retrieved for this Rest API field.

```php
owc/pdc-base/rest-api/pdcitem/field/get-forms
```

##### Filters the data retrieved for this Rest API field.
### Filters the data retrieved for this Rest API field.

```php
owc/pdc-base/rest-api/pdcitem/field/get-downloads
```

##### Filters the data retrieved for this Rest API field.
### Filters the data retrieved for this Rest API field.

```php
owc/pdc-base/rest-api/pdcitem/field/get-title-alternative
```

##### Filters the data retrieved for this Rest API field.
### Filters the data retrieved for this Rest API field.

```php
owc/pdc-base/rest-api/pdcitem/field/get-appointment
```

##### Filters the data retrieved for this Rest API field.
### Filters the data retrieved for this Rest API field.

```php
owc/pdc-base/rest-api/pdcitem/field/get-featured_image
```

##### Filters the data retrieved for this Rest API field.
### Filters the data retrieved for this Rest API field.

```php
owc/pdc-base/rest-api/pdcitem/field/get-taxonomies
owc/pdc-base/core/posttype/posttypes/pdc_item/get-taxonomies/taxonomy-ids
```

##### Filters the data retrieved for this Rest API field.
### Filters the data retrieved for this Rest API field.

```php
owc/pdc-base/rest-api/pdcitem/field/get-connections
```

##### Filters the data retrieved for this Rest API field.
### Filters the data retrieved for this Rest API field.

```php
owc/pdc-base/rest-api/pdcsubcategory/field/has-report
```

##### Filters the data retrieved for this Rest API field.
### Filters the data retrieved for this Rest API field.

```php
owc/pdc-base/rest-api/pdcsubcategory/field/has-appointment
```

##### Filters the metaboxes to be registered just before registration.
### Filters the metaboxes to be registered just before registration.

```php
owc/pdc-base/before-register-metaboxes
```

##### Filters the settings to be registered just before registration.
### Filters the settings to be registered just before registration.

```php
owc/pdc-base/before-register-settings
Expand All @@ -164,7 +168,7 @@ owc/pdc-base/rest-api/shared-items/field/before-creation-featured-image
owc/pdc-base/rest-api/shared-items/field/after-creation-featured-image
```

### Translations
## Translations

If you want to use your own set of labels/names/descriptions and so on you can do so.
All text output in this plugin is controlled via the gettext methods.
Expand All @@ -181,7 +185,7 @@ This plugin provides an easy interface for custom translations and a way to stor
For instructions how to use the 'Loco Translate' plugin, we advice you to read the Beginners's guide page on their website: https://localise.biz/wordpress/plugin/beginners
or start at the homepage: https://localise.biz/wordpress/plugin

### Running tests
## Running tests

To run the Unit tests go to a command-line.

Expand All @@ -197,14 +201,14 @@ For code coverage report, generate report with command line command and view res
composer unit-coverage
```

### Contribution guidelines
## Contribution guidelines

##### Writing tests
### Writing tests

Have a look at the code coverage reports to see where more coverage can be obtained.
Write tests.
Create a Pull request to the OWC repository.

### Who do I talk to?

IF you have questions about or suggestions for this plugin, please contact <a href="mailto:hpeters@buren.nl">Holger Peters</a> from Gemeente Buren.
If you have questions about or suggestions for this plugin, please contact <a href="mailto:hpeters@buren.nl">Holger Peters</a> from Gemeente Buren.
31 changes: 31 additions & 0 deletions bin/package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

## Remove old packages
rm -rf ./releases
mkdir -p ./releases

# Copy current dir to tmp
rsync \
-ua \
--exclude='vendor/*' \
--exclude='releases/*' \
./ ./releases/pdc-base/

# Remove current vendor folder (if any)
# and install the dependencies without dev packages.
cd ./releases/pdc-base || exit
composer install -o --no-dev

# Remove unneeded files in a WordPress plugin
rm -rf ./.git ./composer.json ./.gitignore ./.editorconfig ./.eslintignore \
./.eslintrc ./.php-cs-fixer.php ./composer.lock ./bin \
./phpstan.neon.dist ./phpunit.xml.dist ./tests \
./DOCKER_ENV ./docker_tag ./output.log ./.github

cd ../

# Create a zip file from the optimized plugin folder
zip -rq pdc-base.zip ./pdc-base
rm -rf ./pdc-base

echo "Zip completed @ $(pwd)/pdc-base.zip"
27 changes: 0 additions & 27 deletions bitbucket-pipelines.yml

This file was deleted.

8 changes: 5 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
],
"type": "wordpress-plugin",
"require": {
"php": "^7.0|^8.0",
"johnbillion/extended-cpts": "^4.0"
"php": "^7.4|^8.0",
"johnbillion/extended-cpts": "^4.0",
"yahnis-elsts/plugin-update-checker": "^5.0"
},
"require-dev": {
"10up/wp_mock": "~0.5",
Expand All @@ -37,6 +38,7 @@
"@unit"
],
"unit": "clear && ./vendor/bin/phpunit --testdox --stderr --testsuite 'Unit Test Suite' --colors=always",
"unit-coverage": "clear && XDEBUG_MODE=coverage ./vendor/bin/phpunit --stderr --testsuite 'Unit Test Suite' --prepend tests/xdebug-filter.php --colors=always --coverage-html ./tests/coverage"
"unit-coverage": "clear && XDEBUG_MODE=coverage ./vendor/bin/phpunit --stderr --testsuite 'Unit Test Suite' --prepend tests/xdebug-filter.php --colors=always --coverage-html ./tests/coverage",
"package": "chmod +x ./bin/package.sh && ./bin/package.sh"
}
}
Loading

0 comments on commit 14ffe1f

Please sign in to comment.