GitHub Actions Workflow: Hash Released Files
This workflow automates the management of release asset hashes whenever a new release is published or edited. Here's an overview of its functionality:
Trigger: The workflow is triggered by the publication or editing of a release in the specified repository.
Download Assets: It downloads all assets associated with the release from GitHub.
Check for Downloaded Assets: Before calculating hashes, the workflow checks if any assets were successfully downloaded. If no assets are found, it sets an environment variable to skip subsequent steps.
Calculate SHA256 Hashes: If assets are downloaded, the workflow calculates the SHA256 hash for each asset and saves these hashes in a file named sha256-checksums.txt.
Check Existing Hash File: The workflow checks for an existing version of the hash file. If found, it compares the new hash file to the existing one.
Conditional Upload:
If the hashes match, it skips the upload process.
If the hashes differ, it deletes the existing hash file asset and uploads the new one.
This workflow ensures that each release includes an up-to-date hash file, enabling users to verify the integrity of downloaded assets efficiently.