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: about 1 month 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
- Created: 2020-04-25T13:09:01.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-02-12T17:45:06.000Z (almost 2 years ago)
- Last Synced: 2023-02-27T19:04:22.407Z (over 1 year ago)
- Topics: actions, github, nix, nixpkgs
- Language: TypeScript
- Size: 1.02 MB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Generate Nix Hash
[![Github Workflow](https://github.com/Gerschtli/generate-nix-hash/workflows/build-test/badge.svg)](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)