-
Notifications
You must be signed in to change notification settings - Fork 43
77 lines (62 loc) · 2.67 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
name: Build Plugin ZIP
on:
push:
branches:
- main
jobs:
bump-version:
runs-on: ubuntu-latest
outputs:
old_version: ${{ steps.get_version.outputs.old_version }}
new_version: ${{ steps.get_version.outputs.new_version }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Compute old and new version
id: get_version
run: |
OLD_VERSION=$(jq --raw-output '.version' package.json)
echo "old_version=${OLD_VERSION}" >> $GITHUB_OUTPUT
NEW_VERSION=$(npx semver $OLD_VERSION -i patch)
echo "new_version=${NEW_VERSION}" >> $GITHUB_OUTPUT
- name: Configure git user name and email
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
- name: Update plugin version
env:
VERSION: ${{ steps.get_version.outputs.new_version }}
run: |
cat <<< $(jq --tab --arg version "${VERSION}" '.version = $version' package.json) > package.json
cat <<< $(jq --tab --arg version "${VERSION}" '.version = $version' package-lock.json) > package-lock.json
sed -i "s/${{ steps.get_version.outputs.old_version }}/${VERSION}/g" wpmovies.php
- name: Commit the version bump
id: commit_version_bump
run: |
git add wpmovies.php package.json package-lock.json
git commit -m "Bump plugin version to ${{ steps.get_version.outputs.new_version }}"
git push
echo "version_bump_commit=$(git rev-parse --verify --short HEAD)" >> $GITHUB_OUTPUT
build:
runs-on: ubuntu-latest
needs: bump-version
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install Composer dependencies
run: composer install --no-dev
- name: Install npm dependencies
run: npm ci
- name: Build plugin
run: npm run build
- name: Create plugin ZIP file
run: npm run plugin-zip
- name: Create theme ZIP file
run: npm run theme-zip
- name: Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ needs.bump-version.outputs.new_version }}
files: |
wp-movies-plugin.zip
wp-movies-theme.zip