-
Notifications
You must be signed in to change notification settings - Fork 32
133 lines (112 loc) · 3.77 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# Add build zip to GitHub releases.
# Version: 1.2.0
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Release
on:
push:
tags:
# Semver (https://semver.org/) release pattern.
- '[0-9]+.[0-9]+.[0-9]+*'
jobs:
# Build distribution release.
#
# Performs the following steps:
# - Checks out the repository.
# - Sets up PHP with Composer.
# - Logs debug information.
# - Get Composer Cache Directory.
# - Sets up Composer Caching..
# - Logs debug information.
# - Install Composer dependencies with development dependencies.
# - Setup NodeJS.
# - Get NPM cache directory.
# - Sets up NPM Caching.
# - Install NPM dependencies.
# - Get release version.
# - Check for Alpha release.
# - Check for Beta release.
# - Check for Release Candidate release.
# - Logs debug information.
# - Build release:
# - Pre-release.
# - Stable.
# - Add package to GitHub releases.
dist:
name: "Build distribution release."
runs-on: ubuntu-latest
env:
release: stable
steps:
- name: "Checks out the repository."
uses: "actions/checkout@v3"
- name: "Sets up PHP with Composer."
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
tools: composer
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "Get Composer Cache Directory."
id: composer-cache
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: "Sets up Composer Caching."
uses: "actions/cache@v3"
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-php-composer-build-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-composer-build-
- name: "Logs debug information."
run: |
php --version
composer --version
- name: "Install Composer dependencies with development dependencies."
run: |
composer install --no-interaction --prefer-dist --no-scripts
- name: "Setup NodeJS."
uses: actions/setup-node@v3
with:
node-version: '16'
- name: "Get NPM cache directory."
id: npm-cache-dir
run: |
echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT
- name: "Sets up NPM Caching."
uses: actions/cache@v3
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-node-npm-build-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-npm-build-
- name: "Install NPM dependencies."
run: npm install
- name: "Get release version."
run: |
echo "release_tag=$(node -p -e "require('./package.json').version")" >> $GITHUB_ENV
- name: "Get release file base name."
run: |
echo "release_name=$(node -p -e "require('./package.json').name")" >> $GITHUB_ENV
- name: "Logs debug information."
run: |
node --version
npm --version
echo ${{ env.release_tag }}
echo ${{ env.release_status }}
- name: "Build release and ZIP"
run: |
npm run deploy
- name: WordPress Plugin Deploy
id: deploy
uses: 10up/action-wordpress-plugin-deploy@stable
env:
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
SLUG: ${{ env.release_name }}
BUILD_DIR: ./build
- name: "Add package to GitHub releases."
uses: softprops/action-gh-release@v1
with:
files: ./deploy/${{ env.release_name }}-${{ env.release_tag }}.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}