|
1 | | -name: Check for New Release |
| 1 | +name: Release Workflow |
2 | 2 |
|
3 | 3 | on: |
4 | | - schedule: |
5 | | - - cron: '0 */24 * * *' # Schedule to run every 6 hours |
| 4 | + repository_dispatch: |
| 5 | + types: [trigger-release] |
6 | 6 |
|
7 | 7 | jobs: |
8 | | - check-for-release: |
| 8 | + create-release: |
9 | 9 | runs-on: ubuntu-latest |
| 10 | + |
10 | 11 | steps: |
11 | | - - name: checkout |
| 12 | + - name: Checkout code |
12 | 13 | uses: actions/checkout@v2 |
13 | | - with: |
14 | | - fetch-depth: 0 |
15 | | - - name: check for new release |
| 14 | + |
| 15 | + - name: Set up Git |
16 | 16 | run: | |
17 | | - upstreamTag=$(curl -s "https://api.github.com/repos/IntersectMBO/cardano-node/releases/latest" | jq -r '.tag_name') |
18 | | - forkedTag=$(git describe --tags --abbrev=0) |
| 17 | + git config user.name "nanuijaz" |
| 18 | + git config user.email "nanuijaz@users.noreply.github.com" |
19 | 19 |
|
20 | | - echo "Upstream Tag: $upstreamTag" |
21 | | - echo "Forked Tag: $forkedTag" |
| 20 | + - name: Get latest release version |
| 21 | + id: get-latest-release |
| 22 | + run: | |
| 23 | + latestTag=$(curl -s "https://api.github.com/repos/IntersecMBO/cardano-node/releases/latest" | jq -r '.tag_name') |
| 24 | + echo "::set-output name=tag::$latestTag" |
22 | 25 |
|
23 | | - if [ "$upstreamTag" != "$forkedTag" ]; then |
24 | | - echo "New release detected. Triggering release workflow." |
25 | | - curl -X POST \ |
26 | | - -H "Authorization: Bearer ${{ secrets.WORKFLOW_TOKEN }}" \ |
27 | | - -H "Accept: application/vnd.github.everest-preview+json" \ |
28 | | - -H "Content-Type: application/json" \ |
29 | | - https://api.github.com/repos/emurgo/cardano-node/dispatches \ |
30 | | - --data '{"event_type": "trigger-release"}' |
31 | | - else |
32 | | - echo "No new release detected." |
33 | | - fi |
| 26 | + - name: Create release in forked repository |
| 27 | + run: | |
| 28 | + git tag -a "${{ steps.get-latest-release.outputs.tag }}" -m "Release notes for ${{ steps.get-latest-release.outputs.tag }}" |
| 29 | + git push origin "${{ steps.get-latest-release.outputs.tag }}" |
0 commit comments