-
Notifications
You must be signed in to change notification settings - Fork 1
78 lines (66 loc) · 2.25 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
name: Release new TAG
on:
push:
branches:
- main
jobs:
build-and-release:
name: "Release new TAG"
runs-on: ubuntu-latest
steps:
- name: "Checkout code"
uses: actions/checkout@v3
with:
fetch-depth: 0
- id: set-vars
name: "Set variable from .plugin-data file"
run: |
# Get all data from .plugin-data file
content=`cat ./.plugin-data`
# the following lines are only required for multi line json
content="${content//'%'/'%25'}"
content="${content//$'\n'/'%0A'}"
content="${content//$'\r'/'%0D'}"
# end of optional handling for multi line json
echo "::set-output name=pluginData::$content"
- id: check-version
name: "Check version does not exists"
run: |
# Get the version from .plugin-data file.
VERSION=${{fromJson(steps.set-vars.outputs.pluginData).version}}
echo "Get Branch tag"
if git rev-parse "$VERSION" >/dev/null 2>&1; then
echo "Tag already exists, stop now";
exit 1;
fi
- id: build-js
name: "Build project JS"
uses: actions/setup-node@v4
with:
node-version-file: 'package.json'
- run: yarn install --frozen-lockfile
- run: yarn run build
- id: build-php
name: "Build project PHP"
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
- run: composer install --prefer-dist --no-dev -o
- id: commit-and-push
name: "Commit and push new TAG"
run: |
# Get the version from .plugin-data file.
VERSION=${{fromJson(steps.set-vars.outputs.pluginData).version}}
echo "Copy .distignore to .gitignore"
cp .distignore .gitignore
echo "Configure git"
git config --local user.email "$(git log --format='%ae' HEAD^!)"
git config --local user.name "$(git log --format='%an' HEAD^!)"
echo "Creating branch"
git checkout -b release/${VERSION}
echo "Creating tag ${VERSION}"
git add .
git add -u
git commit -m "Release version ${VERSION}"
git tag ${VERSION}
git push --tags