Skip to content

Commit 848a7d1

Browse files
author
wokamoto
authored
Merge pull request #1 from getshifter/comment
Write comment for workflow
2 parents 3695ab5 + bc4f9fb commit 848a7d1

2 files changed

Lines changed: 45 additions & 5 deletions

File tree

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.github/* export-ignore

.github/workflows/release.yml

Lines changed: 44 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,69 @@
1+
# Workflow Document: https://help.github.com/en/articles/workflow-syntax-for-github-actions
2+
3+
# This workflow detects a tag push to Github, it will automatically upload the package to github releases.
14
name: release
25

6+
# see: https://help.github.com/en/articles/workflow-syntax-for-github-actions#on
37
on:
48
create:
5-
tags:
9+
tags: []
10+
# - v*.*.* # to use filters. wildcard characters supported.
611

12+
# https://help.github.com/en/articles/workflow-syntax-for-github-actions#jobs
713
jobs:
814
release:
915
name: Release
16+
17+
# https://help.github.com/en/articles/workflow-syntax-for-github-actions#jobsjob_idruns-on
1018
runs-on: ubuntu-latest
19+
20+
# https://help.github.com/en/articles/workflow-syntax-for-github-actions#jobsjob_idsteps
1121
steps:
22+
23+
# [official action] clone code to workspace
24+
# https://github.com/actions/checkout
1225
- uses: actions/checkout@v1
26+
27+
28+
# install modules by composer. remove this step it if no needed.
1329
- name: composer install
1430
run: composer install
31+
32+
# install modules by npm.
33+
# - name: npm clean install
34+
# run: npm ci
35+
36+
# remove this step if you want to update the version manually.
37+
# NOTICE: ref_type exists only for events of type create. see https://developer.github.com/v3/activity/events/types/#createevent
1538
- name: add version
39+
env:
40+
PACKAGE_NAME: "shifter-github-hosting-plugin-sample"
1641
run: |
42+
# retrieve tag and replase version number in file.
1743
export CREATE_EVENT_REF_TYPE=$(jq --raw-output .ref_type "$GITHUB_EVENT_PATH")
1844
export TAGNAME=$(jq --raw-output .ref "$GITHUB_EVENT_PATH")
19-
sed -i -e "s/{release version}/${TAGNAME}/g" shifter-github-hosting-plugin-sample.php
45+
sed -i -e "s/{release version}/${TAGNAME}/g" ${PACKAGE_NAME}.php
46+
47+
# create zip acrive for install to WordPress.
48+
# please edit FILES_TO_ARCIVE to suit your project.
2049
- name: create archive
21-
run: zip -r shifter-github-hosting-plugin-sample.zip *.php *.md vendor/*
22-
- name: upload
2350
env:
51+
PACKAGE_NAME: "shifter-github-hosting-plugin-sample"
52+
FILES_TO_ARCIVE: "*.php *.md vendor/*"
53+
run: zip -r ${PACKAGE_NAME}.zip ${FILES_TO_ARCIVE}
54+
55+
# upload zip arvive by ghr.
56+
# `secrets.GITHUB_TOKEN` for using ghr is issued temporarily when executing action. No special settings are required.
57+
# ghr - Easily ship your project to your user using Github Releases : https://deeeet.com/ghr/
58+
- name: upload to github release
59+
env:
60+
PACKAGE_NAME: "shifter-github-hosting-plugin-sample"
2461
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2562
GOPATH: /home/runner/go
2663
run: |
64+
# retrieve tag and replase version number in file.
2765
export CREATE_EVENT_REF_TYPE=$(jq --raw-output .ref_type "$GITHUB_EVENT_PATH")
2866
export TAGNAME=$(jq --raw-output .ref "$GITHUB_EVENT_PATH")
67+
# install ghr, then upload archve.
2968
go get -u github.com/tcnksm/ghr
30-
${GOPATH}/bin/ghr -replace ${TAGNAME} shifter-github-hosting-plugin-sample.zip
69+
${GOPATH}/bin/ghr -b "${PACKAGE_NAME} ${TAGNAME}" -replace ${TAGNAME} ${PACKAGE_NAME}.zip

0 commit comments

Comments
 (0)