-
Notifications
You must be signed in to change notification settings - Fork 1
61 lines (52 loc) · 1.96 KB
/
satis-update.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
name: Trigger Satis Build
on:
release:
types:
- created
env:
VERSION: ${GITHUB_REF#refs/tags/*}
jobs:
webhook:
name: Send Webhook
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Validate version number
if: ${{ (github.repository == 'newfold-labs/wp-module-coming-soon') && (github.event.release.prerelease == false) }}
run: |
taggedVersion=${{ env.VERSION }}
moduleVersion=`grep "define( 'NFD_COMING_SOON_MODULE_VERSION'," bootstrap.php | grep -Eo "[0-9\.]*"`
packageVersion=`grep '"version"' package.json | grep -Eo "[0-9\.]*"`
echo "Tagged version: $taggedVersion"
echo "Module version: $moduleVersion"
echo "Package version: $packageVersion"
[[ "$taggedVersion" == "$moduleVersion" ]] || exit 1
[[ "$taggedVersion" == "$packageVersion" ]] || exit 1
- name: Validate build directory
if: ${{ (github.repository == 'newfold-labs/wp-module-coming-soon') && (github.event.release.prerelease == false) }}
run: |
if [[ ! -d "build/${{ env.VERSION }}" ]]; then
echo "Build directory for version ${{ env.VERSION }} does not exist."
exit 1
fi
- name: Set Package
id: package
env:
REPO: ${{ github.repository }}
run: echo ::set-output name=PACKAGE::${REPO##*/}
- name: Set Version
id: tag
run: echo ::set-output name=VERSION::${GITHUB_REF##*/}
- name: Repository Dispatch
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.WEBHOOK_TOKEN }}
repository: newfold-labs/satis
event-type: 'satis-build'
client-payload: >-
{
"vendor": "${{ github.repository_owner }}",
"package": "${{ steps.package.outputs.PACKAGE }}",
"version": "${{ steps.tag.outputs.VERSION }}"
}