Compute checksums #8
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: Compute checksums | |
on: | |
push: | |
branches: [ checksums ] | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: 'The tag name for which to run it (eg: v3.2.2). If not specified, defaults to the latest release' | |
required: false | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
# Needed permission to upload the release asset | |
contents: write | |
steps: | |
# Only done so I can access the create_cmakelist_diff.py | |
- uses: actions/checkout@v4 | |
- name: Download binaries | |
shell: bash | |
run: | | |
set -x | |
TAG_NAME=${{ github.event.inputs.tag }} | |
if [ -z "$TAG_NAME" ]; then | |
url=https://api.github.com/repos/${{ github.repository }}/releases/latest | |
else | |
url=https://api.github.com/repos/${{ github.repository }}/releases/tags/$TAG_NAME | |
fi | |
echo "Querying url=$url" | |
release_info=$(curl -sL $url) | |
# Get the tag name, and use jq -e to throw if can't find | |
TAG_NAME=$(echo $release_info | jq -r -e '.tag_name') | |
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV | |
echo $release_info | jq -r '.assets[].browser_download_url | select(. | contains("openstudio3"))' > download_lists.txt | |
echo "Found the following assets" | |
cat download_lists.txt | |
echo "Downloading all via aria" | |
aria2c --input-file download_lists.txt -j $(nproc) | |
echo "Files in current directory:" | |
ls | |
- name: Compute md5 sums | |
shell: bash | |
run: | | |
md5sum openstudio3-* > md5sums.txt | |
cat md5sums.txt | |
- name: Compute sha256 sums | |
shell: bash | |
run: | | |
sha256sum openstudio3-* > sha256sums.txt | |
cat sha256sums.txt | |
- name: Upload Sums to release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: '*sums.txt' | |
tag: ${{ env.TAG_NAME }} | |
overwrite: true | |
file_glob: true | |
- name: Create an OpenStudio CMakeLists.txt diff | |
shell: bash | |
run: | | |
python -m pip install requests | |
python create_cmakelist_diff.py --tag-name '${{ env.TAG_NAME }}' --org-name '${{ github.repository_owner }}' --md5-file md5sums.txt | |
- name: Upload CMakeLists diff to release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: '.tmp_diff/CMakeLists.txt.patch' | |
tag: ${{ env.TAG_NAME }} | |
overwrite: true | |
file_glob: false |