diff --git a/.github/workflows/create-release.yaml b/.github/workflows/create-release.yaml index 6d3cfbdfa4c..960aff2b3ef 100644 --- a/.github/workflows/create-release.yaml +++ b/.github/workflows/create-release.yaml @@ -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 }}"