This repository has been archived by the owner on Jul 28, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
73 lines (59 loc) · 2.64 KB
/
release-plugin.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
name: Build Plugin ZIP
on:
push:
branches:
- main-wp-directives-plugin
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" wp-directives.php
- name: Commit the version bump
id: commit_version_bump
run: |
git add wp-directives.php package.json package-lock.json
git commit -m "Bump plugin version to ${{ steps.get_version.outputs.new_version }}"
git push --set-upstream origin main-wp-directives-plugin
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: Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ needs.bump-version.outputs.new_version }}
files: |
block-interactivity-experiments.zip