Skip to content

Commit

Permalink
Update create-release.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
NanuIjaz authored Jan 25, 2024
1 parent a4c2edb commit 68f7d01
Showing 1 changed file with 19 additions and 23 deletions.
42 changes: 19 additions & 23 deletions .github/workflows/create-release.yaml
Original file line number Diff line number Diff line change
@@ -1,33 +1,29 @@
name: Check for New Release
name: Release Workflow

on:
schedule:
- cron: '0 */24 * * *' # Schedule to run every 6 hours
repository_dispatch:
types: [trigger-release]

jobs:
check-for-release:
create-release:
runs-on: ubuntu-latest

steps:
- name: checkout
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: check for new release

- name: Set up Git
run: |
upstreamTag=$(curl -s "https://api.github.com/repos/IntersectMBO/cardano-node/releases/latest" | jq -r '.tag_name')
forkedTag=$(git describe --tags --abbrev=0)
git config user.name "nanuijaz"
git config user.email "nanuijaz@users.noreply.github.com"
echo "Upstream Tag: $upstreamTag"
echo "Forked Tag: $forkedTag"
- name: Get latest release version
id: get-latest-release
run: |
latestTag=$(curl -s "https://api.github.com/repos/IntersecMBO/cardano-node/releases/latest" | jq -r '.tag_name')
echo "::set-output name=tag::$latestTag"
if [ "$upstreamTag" != "$forkedTag" ]; then
echo "New release detected. Triggering release workflow."
curl -X POST \
-H "Authorization: Bearer ${{ secrets.WORKFLOW_TOKEN }}" \
-H "Accept: application/vnd.github.everest-preview+json" \
-H "Content-Type: application/json" \
https://api.github.com/repos/emurgo/cardano-node/dispatches \
--data '{"event_type": "trigger-release"}'
else
echo "No new release detected."
fi
- name: Create release in forked repository
run: |
git tag -a "${{ steps.get-latest-release.outputs.tag }}" -m "Release notes for ${{ steps.get-latest-release.outputs.tag }}"
git push origin "${{ steps.get-latest-release.outputs.tag }}"

0 comments on commit 68f7d01

Please sign in to comment.