Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gerschtli/generate-nix-hash
Github Action to write a JSON file with rev and sha256 of given repository revision.
https://github.com/gerschtli/generate-nix-hash
actions github nix nixpkgs
Last synced: 9 days ago
JSON representation
Github Action to write a JSON file with rev and sha256 of given repository revision.
- Host: GitHub
- URL: https://github.com/gerschtli/generate-nix-hash
- Owner: Gerschtli
- License: mit
- Archived: true
- Created: 2020-04-25T13:09:01.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-09-17T21:16:10.000Z (over 1 year ago)
- Last Synced: 2024-12-26T16:41:43.460Z (about 2 months ago)
- Topics: actions, github, nix, nixpkgs
- Language: TypeScript
- Size: 1.02 MB
- Stars: 3
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Generate Nix Hash
[](https://github.com/Gerschtli/generate-nix-hash/actions)This action fetches the `.tar.gz` archive of the provided repository revision and creates a JSON file containing the revision and sha256 hash generated by `nix-prefetch-url`. As a consequence [`nix`](https://nixos.org/nix) is needed for this action as shown in the example below.
## Usage
Create `.github/workflows/test.yml` in your repo with the following contents:
```yaml
name: "Test"
on:
pull_request:
push:
jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: cachix/install-nix-action@v8
- uses: Gerschtli/generate-nix-hash@v1
with:
rev: c61573364694a68d9993c8b0fb603b29e7251d79 # commit id
owner: Gerschtli
repo: generate-nix-hash
file: config.json
```This produces a JSON file like:
```json
{
"rev": "c61573364694a68d9993c8b0fb603b29e7251d79",
"sha256": "1s0qrrin8ry9klvjaxj4hd3qlf3cayfisq8pn7idqddgcg0lc079"
}
```See [action.yml](action.yml) for all options.
---
## Publish to a distribution branch
Actions are run from GitHub repos so we will checkin the packed dist folder.
Then run [ncc](https://github.com/zeit/ncc) and push the results:
```bash
$ npm run pack
$ git add dist
$ git commit -a -m "prod dependencies"
$ git push origin releases/v1
```Your action is now published! :rocket:
See the [versioning documentation](https://github.com/actions/toolkit/blob/master/docs/action-versioning.md)