Skip to content

Commit 3ce8c06

Browse files
Release updater (#4)
* feat: add updater * fix: uninstallable dependency on PHP > 8 * chore: release 3.1.0 * fix: redundant whitespace
1 parent 8d4470c commit 3ce8c06

9 files changed

Lines changed: 490 additions & 287 deletions

File tree

.github/workflows/release.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
release:
10+
name: Release
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
- uses: php-actions/composer@v6
15+
with:
16+
# Lowest supported PHP version
17+
php_version: "7.4"
18+
- run: composer run package
19+
- name: Release
20+
uses: fnkr/github-action-ghr@v1
21+
env:
22+
GHR_COMPRESS: zip
23+
GHR_PATH: releases/
24+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535

3636
# track this file .gitignore (i.e. do NOT ignore it)
3737
!.gitignore
38+
!.github/
3839

3940
# Eslint
4041
!.eslintrc
@@ -91,6 +92,7 @@ bower_components
9192
*.map
9293

9394
vendor
95+
releases
9496
!/src/vendor
9597

96-
tests/coverage
98+
tests/coverage

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## Version [3.1.0]
8+
9+
### Feat
10+
11+
- Updates can now be provided through the Admin interface
12+
713
## [3.0.5] - 2023-03-10
814

915
### Added

README.md

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,29 @@
1-
# README #
1+
# README
22

33
This README documents whatever steps are necessary to get this plugin up and running.
44

5-
### How do I get set up? ###
5+
### How do I get set up?
66
77
* Unzip and/or move all files to the /wp-content/plugins/pdc-faq directory
88
* Log into WordPress admin and activate the ‘PDC FAQ’ plugin through the ‘Plugins’ menu
99

10+
## Getting started
11+
### Installation
12+
13+
#### For users
14+
1. Download the latest release from [the releases page](https://github.com/OpenWebconcept/plugin-pdc-faq/releases)
15+
2. Unzip and move all files to the `/wp-content/plugins/pdc-faq` directory.
16+
3. Log into the WordPress admin and activate the 'PDC FAQ' plugin through the 'plugins' menu
17+
18+
#### For developers
19+
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.
20+
21+
1. Clone this repository to your machine and/or WordPress installation
22+
2. Optionally use Composer (`composer install`) to install the dev dependencies
23+
24+
To create an optimized and zipped build, run the `composer run package` command. This requires `Composer`, `rsync` and `zip` to run.
25+
26+
1027
### Filters & Actions
1128

1229
There are various [hooks](https://codex.wordpress.org/Plugin_API/Hooks), which allows for changing the output.
@@ -23,7 +40,7 @@ Via the plugin object the following config settings can be adjusted
2340
- rest_api_fields
2441

2542

26-
### Translations ###
43+
### Translations
2744

2845
If you want to use your own set of labels/names/descriptions and so on you can do so.
2946
All text output in this plugin is controlled via the gettext methods.
@@ -40,7 +57,7 @@ This plugin provides an easy interface for custom translations and a way to stor
4057
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
4158
or start at the homepage: https://localise.biz/wordpress/plugin
4259

43-
### Running tests ###
60+
### Running tests
4461
To run the Unit tests go to a command-line.
4562
```bash
4663
cd /path/to/wordpress/htdocs/wp-content/plugins/pdc-faq/
@@ -53,13 +70,13 @@ For code coverage report, generate report with command line command and view res
5370
phpunit --coverage-html ./tests/coverage
5471
```
5572

56-
### Contribution guidelines ###
73+
### Contribution guidelines
5774

5875
##### Writing tests
5976
Have a look at the code coverage reports to see where more coverage can be obtained.
6077
Write tests
6178
Create a Pull request to the OWC repository
6279

63-
### Who do I talk to? ###
80+
### Who do I talk to?
6481

6582
If you have questions about or suggestions for this plugin, please contact <a href="mailto:hpeters@Buren.nl">Holger Peters</a> from Gemeente Buren.

bin/package.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/bash
2+
3+
## Remove old packages
4+
rm -rf ./releases
5+
mkdir -p ./releases
6+
7+
# Copy current dir to tmp
8+
rsync \
9+
-ua \
10+
--exclude='vendor/*' \
11+
--exclude='releases/*' \
12+
./ ./releases/pdc-faq/
13+
14+
# Remove current vendor folder (if any)
15+
# and install the dependencies without dev packages.
16+
cd ./releases/pdc-faq || exit
17+
composer install -o --no-dev
18+
19+
# Remove unneeded files in a WordPress plugin
20+
rm -rf ./.git ./composer.json ./.gitignore ./.editorconfig ./.eslintignore \
21+
./.eslintrc ./.php-cs-fixer.php ./composer.lock ./bin \
22+
./phpstan.neon.dist ./phpunit.xml.dist ./tests \
23+
./DOCKER_ENV ./docker_tag ./output.log ./.github
24+
25+
cd ../
26+
27+
# Create a zip file from the optimized plugin folder
28+
zip -rq pdc-faq.zip ./pdc-faq
29+
rm -rf ./pdc-faq
30+
31+
echo "Zip completed @ $(pwd)/pdc-faq.zip"

composer.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,15 @@
1010
],
1111
"type": "wordpress-plugin",
1212
"require": {
13-
"php": "^7.4|^8.0"
13+
"php": "^7.4|^8.0",
14+
"yahnis-elsts/plugin-update-checker": "^5.1"
1415
},
1516
"require-dev": {
1617
"mockery/mockery": "*",
1718
"phpunit/phpunit": "~8.0",
1819
"10up/wp_mock": "~0.4",
1920
"friendsofphp/php-cs-fixer": "^2.0",
20-
"szepeviktor/phpstan-wordpress": "^0.6.0"
21+
"szepeviktor/phpstan-wordpress": "^1.3.0"
2122
},
2223
"autoload": {
2324
"psr-4": {
@@ -38,6 +39,7 @@
3839
"test": [
3940
"@unit",
4041
"@integration"
41-
]
42+
],
43+
"package": "chmod +x ./bin/package.sh && ./bin/package.sh"
4244
}
4345
}

0 commit comments

Comments
 (0)