Skip to content

feat: upgrade "Compare checksums" action - #2917

Merged
Keith-CY merged 1 commit into
developfrom
feat-checksums
Oct 30, 2023
Merged

feat: upgrade "Compare checksums" action#2917
Keith-CY merged 1 commit into
developfrom
feat-checksums

Conversation

@devchenyan

@devchenyan devchenyan commented Oct 30, 2023

Copy link
Copy Markdown
Contributor

Issue:
Magickbase/neuron-public-issues#295

Test Job:

https://github.com/devchenyan/neuron/actions/runs/6687543940

Test check_checksums.yml:

name: Check Checksums

on:
  push:
  release:
    types: [published, prereleased]

jobs:
  compare:
    name: Compare checksums
    runs-on: macos-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Generate checksums from artifacts
        run: ruby ./scripts/release-checksums.rb v0.111.0 | tee generated_checksums.txt

      - name: Fetch checksums from release note
        run: |
          curl "https://api.github.com/repos/nervosnetwork/neuron/releases/tags/v0.111.0" |\
          python3 -c "import sys, json; print(\"\n\".join(json.load(sys.stdin)['body'].splitlines()[-11:]))" |\
          tee release_note_checksums.txt

      - name: Compare
        run: diff generated_checksums.txt release_note_checksums.txt

      - id: comment_body
        run: |
          body=$(cat generated_checksums.txt)
          body="${body//'%'/'%25'}"
          body="${body//$'\n'/'%0A'}"
          body="${body//$'\r'/'%0D'}"
          echo "body=$body" >> $GITHUB_OUTPUT

      - uses: peter-evans/commit-comment@v2
        with:
          body: ${{ steps.comment_body.outputs.body }}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants