Skip to content

Commit 5245865

Browse files
Rewrite and rework of the build and publish process (#17)
* Removal of old build scripts and files * Rewrote pretty much everything there was * Workflow tweak test * Composer update and workflow tweaks * Tweak * Tweaks and build * Cached and build * More testing * Cached and build * Test pushing to master * Testing a wild idea, will probably fail * New test * Add identity * workflow tests * workflow tests * workflow tests * workflow tests * workflow tests * Break workflow to jobs * Tweaks * Combined jobs back together, didn't work * Changed schedule from high load times https://docs.github.com/en/actions/reference/events-that-trigger-workflows#scheduled-events * Composer caching * Wording changes and dropped cache time * Added description to packages * Added MIT License file * Some templating work to make it look pretty * Workflow changes and updated config/*.json * Tweaks to workflow * Temporarily add push action trigger back * Tweak * Trying to work out action permission error * Tweaks 'n stuff * Remove extra files and fixed readme * Removed push action trigger Co-authored-by: WP-Languages bot <[email protected]>
1 parent 37ad27e commit 5245865

33 files changed

+2714
-35952
lines changed

.editorconfig

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
indent_size = 4
7+
indent_style = space
8+
insert_final_newline = true
9+
max_line_length = 160
10+
tab_width = 4
11+
trim_trailing_whitespace = true
12+
13+
[*.yaml]
14+
indent_size = 2
15+
tab_width = 2
+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: "Refresh Composer Packages Listing"
2+
3+
on:
4+
schedule:
5+
- cron: '15 * * * *' # Runs only on default branch
6+
7+
jobs:
8+
setup:
9+
name: Setup, Build and Publish
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Git Checkout
13+
uses: actions/checkout@v2
14+
with:
15+
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.
16+
17+
- name: Setup Git for later
18+
run: |
19+
git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/*
20+
git config user.email "[email protected]"
21+
git config user.name "WP-Languages bot"
22+
23+
- name: Get composer cache directory
24+
id: composer-cache
25+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
26+
27+
- name: Cache Composer Dependencies
28+
uses: actions/cache@v2
29+
with:
30+
path: ${{ steps.composer-cache.outputs.dir }}
31+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
32+
restore-keys: ${{ runner.os }}-composer-
33+
34+
- name: Cache WordPress.org API Payloads
35+
uses: actions/cache@v2
36+
with:
37+
path: ./cache
38+
key: ${{ runner.os }}-packages-${{ hashFiles('**/config/wp-packages.json') }}
39+
40+
- name: Install Composer Dependencies
41+
uses: php-actions/composer@v6
42+
with:
43+
php_version: 7.4
44+
version: 2
45+
46+
- name: Cache and Build the Repository
47+
uses: php-actions/composer@v6
48+
with:
49+
command: run-script cache-build-ci
50+
51+
- name: Prepare our repository for publishing
52+
run: |
53+
git config --local user.email "[email protected]"
54+
git config --local user.name "WP-Languages bot"
55+
git rm -rf .github bin cache config src views README.md composer.*
56+
echo "*" > './.gitignore'
57+
echo "!include/\n!index.html\npackages.json" >> './.gitignore'
58+
git add -f include/* index.html packages.json
59+
git commit -a -m "Automated build"
60+
61+
- name: Publish changes to master branch
62+
uses: ad-m/github-push-action@master
63+
with:
64+
github_token: ${{ secrets.GITHUB_TOKEN }}
65+
branch: master
66+
force: true
67+
68+
cleanup:
69+
if: always()
70+
needs: [ setup ]
71+
name: Clean old actions/composer packages
72+
runs-on: ubuntu-latest
73+
steps:
74+
- name: Delete old actions/composer packages
75+
uses: actions/delete-package-versions@v1
76+
with:
77+
package-name: 'php-actions_composer_wp-languages.github.io'

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@ vendor
55
satis.json
66

77
# Ignore static html build by satis
8-
_site
8+
include/*
9+
packages.json
10+
index.html

.travis.yml

-29
This file was deleted.

LICENSE.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
The MIT License (MIT)
2+
Copyright © 2021 wp-languages.github.io
3+
4+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
5+
6+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
7+
8+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

+122-102
Original file line numberDiff line numberDiff line change
@@ -1,102 +1,122 @@
1-
# wp-languages.github.io
2-
[![Build Status](https://travis-ci.org/wp-languages/wp-languages.github.io.svg?branch=src)](https://travis-ci.org/wp-languages/wp-languages.github.io) [![License](http://img.shields.io/:license-mit-blue.svg)](http://doge.mit-license.org)
3-
4-
## Features
5-
- Supports **https** by using github.io ssl. Composer default configuration only accepts **https** by default starting from 2016.
6-
- Automatically creates composer packages for WordPress translations from api.wordpress.org.
7-
- This repo provides custom satis repository for WordPress languages. See more in [wp-languages.github.io](https://wp-languages.github.io/).
8-
- If you would like to add more language files please submit a pull request.
9-
- Repos are updated daily with Travis CI.
10-
11-
## Example configuration with composer
12-
13-
This example adds all translations from finnish and french packages.
14-
```json
15-
{
16-
"repositories": [
17-
{
18-
"type": "composer",
19-
"url": "https://wp-languages.github.io"
20-
}
21-
],
22-
"require": {
23-
"koodimonni-language/fi": "*",
24-
"koodimonni-language/fr_FR": "*"
25-
},
26-
"extra": {
27-
"dropin-paths": {
28-
"htdocs/wp-content/languages/": ["vendor:koodimonni-language"],
29-
"htdocs/wp-content/languages/plugins/": ["vendor:koodimonni-plugin-language"],
30-
"htdocs/wp-content/languages/themes/": ["vendor:koodimonni-theme-language"]
31-
}
32-
}
33-
}
34-
```
35-
36-
## Request packages
37-
If package what you're looking for can't be found look first the response from api:
38-
39-
[https://api.wordpress.org/translations/core/1.0/](https://api.wordpress.org/translations/core/1.0/)
40-
41-
If your language is not listed in the response we can't help you. You'll need to ask from wp-core translators instead.
42-
43-
This is pretty static repository and we can't add all possible plugins here.
44-
45-
## Manually adding any language zip to your composer.json
46-
There's also manual method of including any translation in wordpress.org. This is useful because we can't include all plugins in this repository. Let's look how to add french (fr_FR) jetpack translations. First search the api for jetpack translations:
47-
48-
```bash
49-
$ curl -s 'https://api.wordpress.org/translations/plugins/1.0/?slug=jetpack' | python -m json.tool
50-
```
51-
52-
Choose your language zip from json output for example for us it was:
53-
https://downloads.wordpress.org/translation/plugin/jetpack/3.9.2/fr_FR.zip
54-
55-
Then add it to your composer like this example. You just need to update the version number everytime the package updates.
56-
```json
57-
{
58-
"repositories": [
59-
{
60-
"type": "package",
61-
"package": {
62-
"name": "koodimonni-plugin-language/jetpack-fr_FR",
63-
"type": "wordpress-language",
64-
"version": "3.9.2",
65-
"dist": {
66-
"type": "zip",
67-
"url": "https://downloads.wordpress.org/translation/plugin/jetpack/3.9.2/fr_FR.zip",
68-
"reference": "master"
69-
}
70-
}
71-
}
72-
],
73-
"require": {
74-
"koodimonni/composer-dropin-installer": "*",
75-
"koodimonni-plugin-language/jetpack-fr_FR": ">=3.9.2"
76-
},
77-
"extra": {
78-
"dropin-paths": {
79-
"htdocs/wp-content/languages/": ["vendor:koodimonni-language"],
80-
"htdocs/wp-content/languages/plugins/": ["vendor:koodimonni-plugin-language"],
81-
"htdocs/wp-content/languages/themes/": ["vendor:koodimonni-theme-language"]
82-
}
83-
}
84-
}
85-
```
86-
87-
## How to use this project as self-hosted version:
88-
89-
```
90-
# Clone the project to your own server
91-
$ git clone https://github.com/wp-languages/wp-languages.github.io /to/your/htdocs
92-
$ cd /to/your/htdocs
93-
$ composer install
94-
95-
# Set new cronjob
96-
$ crontab -e
97-
# Add following line to your cron
98-
*/30 * * * * cd /to/your/htdocs && php bin/wp-org-api && php bin/satis satis.json .
99-
```
100-
101-
## License
102-
MIT License
1+
# wp-languages.github.io
2+
[![License](http://img.shields.io/:license-mit-blue.svg)](http://doge.mit-license.org)
3+
4+
## Features
5+
- Supports **https** by using github.io ssl. Composer default configuration only accepts **https** by default starting from 2016.
6+
- Automatically creates composer packages for WordPress translations from api.wordpress.org.
7+
- This repo provides custom satis repository for WordPress languages. See more in [wp-languages.github.io](https://wp-languages.github.io/).
8+
- To add more language files please submit a pull request to the `src` branch.
9+
- Repos are updated hourly with GitHub Actions.
10+
11+
## Example configuration with composer
12+
13+
This example adds all translations from finnish and french packages.
14+
```json
15+
{
16+
"repositories": [
17+
{
18+
"type": "composer",
19+
"url": "https://wp-languages.github.io",
20+
"only": [
21+
"koodimonni-language/*",
22+
"koodimonni-plugin-language/*",
23+
"koodimonni-theme-language/*"
24+
]
25+
}
26+
],
27+
"require": {
28+
"koodimonni-language/fi": "*",
29+
"koodimonni-language/fr_fr": "*"
30+
},
31+
"extra": {
32+
"dropin-paths": {
33+
"htdocs/wp-content/languages/": [
34+
"vendor:koodimonni-language"
35+
],
36+
"htdocs/wp-content/languages/plugins/": [
37+
"vendor:koodimonni-plugin-language"
38+
],
39+
"htdocs/wp-content/languages/themes/": [
40+
"vendor:koodimonni-theme-language"
41+
]
42+
}
43+
}
44+
}
45+
```
46+
47+
## Request packages
48+
If package what you're looking for can't be found look first the response from api:
49+
50+
[https://api.wordpress.org/translations/core/1.0/](https://api.wordpress.org/translations/core/1.0/)
51+
52+
If your language is not listed in the response we can't help you. You'll need to ask from wp-core translators instead.
53+
54+
This is pretty static repository, and we can't add all possible plugins here.
55+
56+
## Manually adding any language zip to your composer.json
57+
There's also manual method of including any translation in WordPress.org. This is useful because we can't include all plugins in this repository. Let's look how to add french (fr_FR) jetpack translations. First search the api for jetpack translations:
58+
59+
```bash
60+
$ curl -s 'https://api.wordpress.org/translations/plugins/1.0/?slug=jetpack' | python -m json.tool
61+
```
62+
63+
Choose your language zip from json output for example for us it was:
64+
https://downloads.wordpress.org/translation/plugin/jetpack/3.9.2/fr_FR.zip
65+
66+
Then add it to your composer like this example. You just need to update the version number everytime the package updates.
67+
```json
68+
{
69+
"repositories": [
70+
{
71+
"type": "package",
72+
"package": {
73+
"name": "koodimonni-plugin-language/jetpack-fr_fr",
74+
"type": "wordpress-language",
75+
"version": "3.9.2",
76+
"dist": {
77+
"type": "zip",
78+
"url": "https://downloads.wordpress.org/translation/plugin/jetpack/3.9.2/fr_FR.zip",
79+
"reference": "master"
80+
}
81+
}
82+
}
83+
],
84+
"require": {
85+
"koodimonni/composer-dropin-installer": "*",
86+
"koodimonni-plugin-language/jetpack-fr_fr": ">=3.9.2"
87+
},
88+
"extra": {
89+
"dropin-paths": {
90+
"htdocs/wp-content/languages/": [
91+
"vendor:koodimonni-language"
92+
],
93+
"htdocs/wp-content/languages/plugins/": [
94+
"vendor:koodimonni-plugin-language"
95+
],
96+
"htdocs/wp-content/languages/themes/": [
97+
"vendor:koodimonni-theme-language"
98+
]
99+
}
100+
}
101+
}
102+
```
103+
104+
## How to use this project as self-hosted version:
105+
106+
```bash
107+
# Clone the project to your own server
108+
git clone https://github.com/wp-languages/wp-languages.github.io /to/your/htdocs
109+
cd /to/your/htdocs
110+
composer install
111+
112+
# Set new cronjob
113+
crontab -e
114+
115+
# Add following line to your cron
116+
0 */2 * * * cd /to/your/htdocs && composer run-script cache-build
117+
```
118+
119+
And serve the generated `docs` folder.
120+
121+
## License
122+
MIT License

_config/.travis.yml

-7
This file was deleted.

_config/README.md

-11
This file was deleted.

0 commit comments

Comments
 (0)