Skip to content

Commit bf79250

Browse files
author
wokamoto
committed
First commit
0 parents  commit bf79250

6 files changed

Lines changed: 280 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: release
2+
3+
on:
4+
create:
5+
tags:
6+
7+
jobs:
8+
release:
9+
name: Release
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v1
13+
- name: composer install
14+
run: composer install
15+
- name: add version
16+
run: |
17+
export CREATE_EVENT_REF_TYPE=$(jq --raw-output .ref_type "$GITHUB_EVENT_PATH")
18+
export TAGNAME=$(jq --raw-output .ref "$GITHUB_EVENT_PATH")
19+
sed -i -e "s/{release version}/${TAGNAME}/g" shifter-github-hosting-plugin-sample.php
20+
- name: create archive
21+
run: zip -r *.zip *.md vendor/*
22+
- name: upload
23+
env:
24+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25+
GOPATH: /home/runner/go
26+
run: |
27+
export CREATE_EVENT_REF_TYPE=$(jq --raw-output .ref_type "$GITHUB_EVENT_PATH")
28+
export TAGNAME=$(jq --raw-output .ref "$GITHUB_EVENT_PATH")
29+
go get -u github.com/tcnksm/ghr
30+
${GOPATH}/bin/ghr -prerelease -replace ${TAGNAME} shifter-github-hosting-plugin-sample.zip

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
vendor/
2+
*.zip

README.md

Whitespace-only changes.

composer.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"require": {
3+
"yuzuru-s/parse-rss": "1.0.*"
4+
}
5+
}

composer.lock

Lines changed: 179 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<?php
2+
/*
3+
Plugin Name: Shifter GitHub hosting plugin sample
4+
Plugin URI: https://github.com/getshifter/shifter-github-hosting-plugin-sample/
5+
Description: Shifter GitHub hosting plugin sample
6+
Author: Shifter Team
7+
Version: {release version}
8+
Author URI: https://getshifter.io/
9+
*/
10+
require __DIR__ . '/vendor/autoload.php';
11+
12+
add_action( 'admin_notices', function() {
13+
// get Shifter News
14+
$transient_key = 'shifter-news-posts';
15+
if (false === ($posts = get_transient($transient_key))) {
16+
$url = 'https://www.getshifter.io/feed/';
17+
$res = YuzuruS\Rss\Feed::load($url);
18+
19+
$posts = [];
20+
foreach ($res['item'] as $r) {
21+
$posts[] = sprintf(
22+
'<a href="%s" title="%s">%s</a>',
23+
esc_url_raw($r['link']),
24+
esc_attr($r['title']),
25+
$r['title']
26+
);
27+
}
28+
set_transient($transient_key, $posts, HOUR_IN_SECONDS);
29+
}
30+
$shifter_news = $posts[ mt_rand( 0, count( $posts ) - 1 ) ];
31+
32+
printf(
33+
'<p id="shifter"><span dir="ltr" lang="en">%s</span></p>',
34+
$shifter_news
35+
);
36+
});
37+
38+
add_action( 'admin_head', function() {
39+
echo "
40+
<style type='text/css'>
41+
#shifter {
42+
float: right;
43+
padding: 5px 10px;
44+
margin: 0;
45+
font-size: 12px;
46+
line-height: 1.6666;
47+
}
48+
.rtl #shifter {
49+
float: left;
50+
}
51+
.block-editor-page #shifter {
52+
display: none;
53+
}
54+
@media screen and (max-width: 782px) {
55+
#shifter,
56+
.rtl #shifter {
57+
float: none;
58+
padding-left: 0;
59+
padding-right: 0;
60+
}
61+
}
62+
</style>
63+
";
64+
});

0 commit comments

Comments
 (0)