New workflow which verifies sha hashes in CI #1
Workflow file for this run
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
name: Verify Spacetime SHA Hashes | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
jobs: | |
verify-sha: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- name: Parse ARM/AMD URL and SHA from Formula/spacetime.rb | |
id: parse | |
run: | | |
# Extract ARM url and sha256 (between `if Hardware::CPU.arm?` and `else`) | |
URL_ARM=$(awk '/if Hardware::CPU.arm\?/,/else/' Formula/spacetime.rb | grep 'url' | sed 's/.*"\(.*\)".*/\1/') | |
SHA_ARM=$(awk '/if Hardware::CPU.arm\?/,/else/' Formula/spacetime.rb | grep 'sha256' | sed 's/.*"\(.*\)".*/\1/') | |
# Extract AMD url and sha256 (between `else` and `end`) | |
URL_AMD=$(awk '/else/,/end/' Formula/spacetime.rb | grep 'url' | sed 's/.*"\(.*\)".*/\1/') | |
SHA_AMD=$(awk '/else/,/end/' Formula/spacetime.rb | grep 'sha256' | sed 's/.*"\(.*\)".*/\1/') | |
echo "URL_ARM=$URL_ARM" >> $GITHUB_ENV | |
echo "SHA_ARM=$SHA_ARM" >> $GITHUB_ENV | |
echo "URL_AMD=$URL_AMD" >> $GITHUB_ENV | |
echo "SHA_AMD=$SHA_AMD" >> $GITHUB_ENV | |
- name: Verify ARM tarball | |
run: | | |
curl -L "$URL_ARM" -o spacetime-arm.tar.gz | |
echo "$SHA_ARM spacetime-arm.tar.gz" | sha256sum --check | |
- name: Verify AMD tarball | |
run: | | |
curl -L "$URL_AMD" -o spacetime-amd.tar.gz | |
echo "$SHA_AMD spacetime-amd.tar.gz" | sha256sum --check | |