Skip to content

Commit 223f88a

Browse files
committed
add release.yml
1 parent 8275c03 commit 223f88a

File tree

2 files changed

+87
-0
lines changed

2 files changed

+87
-0
lines changed

.github/workflows/release.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# This is a sample workflows file for GitHub Actions.
2+
#
3+
# This workflow detects a tag, creates a package with the tag, then automatically uploads the package to GitHub releases.
4+
#
5+
# At first, please change PACKAGE_NAME to your package name.
6+
# Also, if you need:
7+
# - change FILES_TO_ARCIVE
8+
# - comment out the composer install section
9+
# - uncomment npm install section
10+
11+
# Workflow Document: https://help.github.com/en/articles/workflow-syntax-for-github-actions
12+
#
13+
name: release
14+
15+
# see: https://help.github.com/en/articles/workflow-syntax-for-github-actions#on
16+
on:
17+
create:
18+
tags: []
19+
# - v*.*.* # to use filters. wildcard characters are supported.
20+
21+
# https://help.github.com/en/articles/workflow-syntax-for-github-actions#jobs
22+
jobs:
23+
release:
24+
name: Release
25+
26+
# https://help.github.com/en/articles/workflow-syntax-for-github-actions#jobsjob_idruns-on
27+
runs-on: ubuntu-latest
28+
29+
# https://help.github.com/en/articles/workflow-syntax-for-github-actions#jobsjob_idsteps
30+
steps:
31+
32+
# [official action] clone code to workspace
33+
# https://github.com/actions/checkout
34+
- uses: actions/checkout@v1
35+
36+
37+
# install modules by composer. remove this step it if you don't need.
38+
# - name: composer install
39+
# run: composer install
40+
41+
# install modules by npm.
42+
# - name: npm clean install
43+
# run: npm ci
44+
45+
# remove this step if you want to update the version manually.
46+
# NOTICE: ref_type exists only for events of type create. see https://developer.github.com/v3/activity/events/types/#createevent
47+
- name: add version
48+
env:
49+
PACKAGE_NAME: "index"
50+
run: |
51+
# retrieve tag and replase version number in file.
52+
export CREATE_EVENT_REF_TYPE=$(jq --raw-output .ref_type "$GITHUB_EVENT_PATH")
53+
export TAGNAME=$(jq --raw-output .ref "$GITHUB_EVENT_PATH")
54+
sed -i -e "s/{release version}/${TAGNAME}/g" ${PACKAGE_NAME}.php
55+
# create a zip acrive for installing to WordPress.
56+
# please change FILES_TO_ARCIVE to your project name.
57+
- name: create archive
58+
env:
59+
PACKAGE_NAME: "JavaScript-If-Display"
60+
FILES_TO_ARCIVE: "*.php *.md LICENSE vendor/*"
61+
run: zip -r ${PACKAGE_NAME}.zip ${FILES_TO_ARCIVE}
62+
63+
# upload zip arvive by ghr.
64+
# `secrets.GITHUB_TOKEN` for using ghr is issued temporarily when executing action. No special settings are required.
65+
# ghr - Easily ship your project to your user using Github Releases : https://deeeet.com/ghr/
66+
- name: upload to github release
67+
env:
68+
PACKAGE_NAME: "JavaScript-If-Display"
69+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70+
GOPATH: /home/runner/go
71+
run: |
72+
# retrieve tag and replase version number in file.
73+
export CREATE_EVENT_REF_TYPE=$(jq --raw-output .ref_type "$GITHUB_EVENT_PATH")
74+
export TAGNAME=$(jq --raw-output .ref "$GITHUB_EVENT_PATH")
75+
# install ghr, then upload archve.
76+
go get -u github.com/tcnksm/ghr
77+
${GOPATH}/bin/ghr -b "${PACKAGE_NAME} ${TAGNAME}" -replace ${TAGNAME} ${PACKAGE_NAME}.zip

index.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
/*
3+
Plugin Name: JavaScript Content Message
4+
Plugin URI: https://github.com/pitolick/JavaScript-Content-Message
5+
Description: 特定の期間が経過した投稿・固定ページにメッセージを出力します
6+
Version: {release version}
7+
Author: ぴいた
8+
License: GPL2
9+
*/
10+

0 commit comments

Comments
 (0)