|
| 1 | +name: Notify dependents — GemsPy new release |
| 2 | + |
| 3 | +on: |
| 4 | + release: |
| 5 | + types: [published] |
| 6 | + workflow_dispatch: |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: read |
| 10 | + |
| 11 | +jobs: |
| 12 | + notify: |
| 13 | + name: Create issue in dependent repositories |
| 14 | + runs-on: ubuntu-latest |
| 15 | + |
| 16 | + steps: |
| 17 | + - name: Get release version |
| 18 | + id: version |
| 19 | + run: | |
| 20 | + VERSION="${{ github.event.release.tag_name }}" |
| 21 | + VERSION="${VERSION#v}" |
| 22 | + echo "version=$VERSION" >> "$GITHUB_OUTPUT" |
| 23 | + echo "Released version: $VERSION" |
| 24 | +
|
| 25 | + - name: Notify GEMS repository |
| 26 | + uses: actions/github-script@v9 |
| 27 | + with: |
| 28 | + github-token: ${{ secrets.GEMS_REPO_PAT }} |
| 29 | + script: | |
| 30 | + const version = '${{ steps.version.outputs.version }}'; |
| 31 | + const title = `[GEMSPY UPDATE] New release: v${version}`; |
| 32 | + const owner = context.repo.owner; |
| 33 | +
|
| 34 | + const existing = await github.rest.issues.listForRepo({ |
| 35 | + owner: owner, |
| 36 | + repo: 'GEMS', |
| 37 | + state: 'open', |
| 38 | + }); |
| 39 | +
|
| 40 | + const duplicate = existing.data.find(i => i.title.includes(`v${version}`)); |
| 41 | + if (duplicate) { |
| 42 | + console.log(`Issue already exists in GEMS: #${duplicate.number} — skipping.`); |
| 43 | + return; |
| 44 | + } |
| 45 | +
|
| 46 | + const body = [ |
| 47 | + '> This issue was automatically created by the `notify-gemspy-release` workflow in GemsPy.', |
| 48 | + '', |
| 49 | + '## New Version Detected', |
| 50 | + '', |
| 51 | + '| | |', |
| 52 | + '|---|---|', |
| 53 | + `| **New version** | \`${version}\` |`, |
| 54 | + `| **PyPI page** | https://pypi.org/project/gemspy/${version}/ |`, |
| 55 | + `| **Release notes** | https://github.com/${owner}/GemsPy/releases/tag/v${version} |`, |
| 56 | + '', |
| 57 | + '## Triage', |
| 58 | + '', |
| 59 | + '- [ ] GemsPy changelog reviewed', |
| 60 | + '- [ ] No action needed (if release has no impact on GEMS)', |
| 61 | + ].join('\n'); |
| 62 | +
|
| 63 | + const result = await github.rest.issues.create({ |
| 64 | + owner: owner, |
| 65 | + repo: 'GEMS', |
| 66 | + title: title, |
| 67 | + body: body, |
| 68 | + }); |
| 69 | +
|
| 70 | + console.log(`Issue created in GEMS: #${result.data.number} — ${result.data.html_url}`); |
| 71 | +
|
| 72 | + - name: Notify AntaresLegacyModels-to-GEMS-Converter repository |
| 73 | + uses: actions/github-script@v9 |
| 74 | + with: |
| 75 | + github-token: ${{ secrets.GEMS_REPO_PAT }} |
| 76 | + script: | |
| 77 | + const version = '${{ steps.version.outputs.version }}'; |
| 78 | + const title = `[GEMSPY UPDATE] New release: v${version}`; |
| 79 | + const owner = context.repo.owner; |
| 80 | +
|
| 81 | + const existing = await github.rest.issues.listForRepo({ |
| 82 | + owner: owner, |
| 83 | + repo: 'AntaresLegacyModels-to-GEMS-Converter', |
| 84 | + state: 'open', |
| 85 | + }); |
| 86 | +
|
| 87 | + const duplicate = existing.data.find(i => i.title.includes(`v${version}`)); |
| 88 | + if (duplicate) { |
| 89 | + console.log(`Issue already exists in AntaresLegacyModels-to-GEMS-Converter: #${duplicate.number} — skipping.`); |
| 90 | + return; |
| 91 | + } |
| 92 | +
|
| 93 | + const body = [ |
| 94 | + '> This issue was automatically created by the `notify-gemspy-release` workflow in GemsPy.', |
| 95 | + '', |
| 96 | + '## New Version Detected', |
| 97 | + '', |
| 98 | + '| | |', |
| 99 | + '|---|---|', |
| 100 | + `| **New version** | \`${version}\` |`, |
| 101 | + `| **PyPI page** | https://pypi.org/project/gemspy/${version}/ |`, |
| 102 | + `| **Release notes** | https://github.com/${owner}/GemsPy/releases/tag/v${version} |`, |
| 103 | + '', |
| 104 | + '## Triage', |
| 105 | + '', |
| 106 | + '- [ ] GemsPy changelog reviewed', |
| 107 | + '- [ ] A2G-04 issue opened (if API changes affect GEMS study generation, model validation, or simulation output)', |
| 108 | + '- [ ] No action needed (if release has no impact on the converter)', |
| 109 | + ].join('\n'); |
| 110 | +
|
| 111 | + const result = await github.rest.issues.create({ |
| 112 | + owner: owner, |
| 113 | + repo: 'AntaresLegacyModels-to-GEMS-Converter', |
| 114 | + title: title, |
| 115 | + body: body, |
| 116 | + }); |
| 117 | +
|
| 118 | + console.log(`Issue created in AntaresLegacyModels-to-GEMS-Converter: #${result.data.number} — ${result.data.html_url}`); |
0 commit comments