forked from IntersectMBO/cardano-node
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
19 additions
and
23 deletions.
There are no files selected for viewing
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
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 }}" |