-
Notifications
You must be signed in to change notification settings - Fork 10
65 lines (53 loc) · 2.55 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# Workflow Document: https://help.github.com/en/articles/workflow-syntax-for-github-actions
# This workflow detects a tag push to Github, it will automatically upload the package to github releases.
name: release
# see: https://help.github.com/en/articles/workflow-syntax-for-github-actions#on
on:
push:
tags:
# - v*.*.* # to use filters. wildcard characters supported.
# https://help.github.com/en/articles/workflow-syntax-for-github-actions#jobs
jobs:
release:
name: Release
# https://help.github.com/en/articles/workflow-syntax-for-github-actions#jobsjob_idruns-on
runs-on: ubuntu-latest
# https://help.github.com/en/articles/workflow-syntax-for-github-actions#jobsjob_idsteps
steps:
# [official action] clone code to workspace
# https://github.com/actions/checkout
- uses: actions/checkout@v1
# install modules by composer. remove this step it if no needed.
# - name: composer install
# run: composer install
# install modules by npm.
# - name: npm clean install
# run: npm ci
# remove this step if you want to update the version manually.
# NOTICE: ref_type exists only for events of type create. see https://developer.github.com/v3/activity/events/types/#createevent
- name: add version
run: |
# retrieve tag and replace version number in file.
export TAGNAME=$(echo "${GITHUB_REF#refs/tags/}")
sed -i -e "s/{release version}/${TAGNAME}/g" style.css
# create zip archive for install to WordPress.
# please edit FILES_TO_ARCHIVE to suit your project.
- name: create archive
env:
PACKAGE_NAME: "shifter-github-hosting-theme-sample"
FILES_TO_ARCHIVE: "*.php *.md *.css *.txt *.png LICENSE phpcs.xml.dist inc/ js/ languages/ layouts/ template-parts/"
run: zip -r ${PACKAGE_NAME}.zip ${FILES_TO_ARCHIVE}
# upload zip archive by ghr.
# `secrets.GITHUB_TOKEN` for using ghr is issued temporarily when executing action. No special settings are required.
# ghr - Easily ship your project to your user using Github Releases : https://deeeet.com/ghr/
- name: upload
env:
PACKAGE_NAME: "shifter-github-hosting-theme-sample"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GOPATH: /home/runner/go
run: |
# retrieve tag and replase version number in file.
export TAGNAME=$(echo "${GITHUB_REF#refs/tags/}")
# install ghr, then upload archve.
go install github.com/tcnksm/ghr@latest
${GOPATH}/bin/ghr -b "${PACKAGE_NAME} ${TAGNAME}" -replace ${TAGNAME} ${PACKAGE_NAME}.zip