Trigger release #97
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |