-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (43 loc) · 1.29 KB
/
trigger.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
name: Trigger release
on:
workflow_dispatch:
workflow_run:
workflows: ["Sync repo"]
types:
- completed
jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Find latest tag of source repo
uses: oprypin/find-latest-tag@v1
with:
repository: casey/just
regex: '^\d+\.\d+\.\d+$'
releases-only: true
id: sourcetag
- name: Find latest tag of target repo
uses: oprypin/find-latest-tag@v1
with:
repository: gnpaone/rust-just
releases-only: true
id: targettag
- run: npm install semver
- name: Check for new release
uses: actions/github-script@v7
id: rel-chk
with:
script: |
const semver = require('semver');
const ver1 = `${{ steps.sourcetag.outputs.tag }}`;
const ver2 = `${{ steps.targettag.outputs.tag }}`;
if (semver.gt(ver1, ver2)) {
core.setOutput('create_release', true);
} else {
core.setOutput('create_release', false);
}
- name: Trigger release event
if: steps.rel-chk.outputs.create_release == 'true'
uses: peter-evans/repository-dispatch@v3
with:
event-type: new-release