This repository has been archived by the owner on Mar 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8c993b0
commit 0a13c83
Showing
2 changed files
with
74 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: Post-Release SHA-256 Hash Calculation | ||
on: | ||
release: | ||
types: [published] | ||
jobs: | ||
calculate-hash: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v2 | ||
- name: Fetch Release Assets | ||
id: fetch-assets | ||
uses: actions/github-script@v5 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
script: | | ||
const fs = require('fs'); | ||
const response = await github.rest.repos.listReleaseAssets({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
release_id: context.payload.release.id | ||
}); | ||
const assets = response.data.map(asset => ({ url: asset.url, name: asset.name })); | ||
fs.writeFileSync('assets.json', JSON.stringify(assets)); | ||
- name: Download and Calculate SHA-256 Hashes | ||
run: | | ||
mkdir -p downloads | ||
echo "File Name | SHA-256 Hash" >> SHA256SUMS.txt | ||
echo "--------- | ------------" >> SHA256SUMS.txt | ||
jq -c '.[]' assets.json | while read -r asset; do | ||
url=$(echo $asset | jq -r '.url') | ||
name=$(echo $asset | jq -r '.name') | ||
curl -L -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -H "Accept: application/octet-stream" -o "downloads/$name" "$url" | ||
echo "Calculating SHA-256 for $name" | ||
hash=$(sha256sum "downloads/$name" | awk '{print $1}') | ||
echo "$name | $hash" >> SHA256SUMS.txt | ||
done | ||
- name: Update Release Description with SHA-256 Hashes | ||
uses: actions/github-script@v5 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
const fs = require('fs'); | ||
const sha256sums = fs.readFileSync('SHA256SUMS.txt', 'utf8'); | ||
const { owner, repo } = context.repo; | ||
const release = context.payload.release; | ||
const newBody = release.body + '\n\n### SHA-256 Hashes\n' + sha256sums; | ||
await github.rest.repos.updateRelease({ | ||
owner, | ||
repo, | ||
release_id: release.id, | ||
body: newBody | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,17 @@ | ||
# Quary CLI | ||
<p align="center"> | ||
<a href="https://quary.io/sqlforge"> | ||
<picture> | ||
<source media="(prefers-color-scheme: dark)" srcset="https://utfs.io/f/30765a8e-3dd9-4dc3-b905-11de822e71e4-yajpew.png"> | ||
<img src="https://utfs.io/f/30765a8e-3dd9-4dc3-b905-11de822e71e4-yajpew.png" height="128"> | ||
</picture> | ||
<h1 align="center">Quary CLI</h1> | ||
</a> | ||
</p> | ||
|
||
<p align="center"> | ||
<a aria-label="Quary logo" href="https://quary.io/"> | ||
<img src="https://img.shields.io/badge/MADE%20BY%20Quary-000000.svg?style=for-the-badge&logo=Quary&labelColor=000"> | ||
</a> | ||
</p> | ||
|
||
Learn more at [https://www.quary.dev](https://www.quary.dev) |