Skip to content

Github Action to write a JSON file with rev and sha256 of given repository revision.

License

Notifications You must be signed in to change notification settings

gruve-p/generate-nix-hash

 
 

Repository files navigation

Generate Nix Hash

Github Workflow

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 is needed for this action as shown in the example below.

Usage

Create .github/workflows/test.yml in your repo with the following contents:

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:

{
  "rev": "c61573364694a68d9993c8b0fb603b29e7251d79",
  "sha256": "1s0qrrin8ry9klvjaxj4hd3qlf3cayfisq8pn7idqddgcg0lc079"
}

See 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 and push the results:

$ npm run pack
$ git add dist
$ git commit -a -m "prod dependencies"
$ git push origin releases/v1

Your action is now published! 🚀

See the versioning documentation

About

Github Action to write a JSON file with rev and sha256 of given repository revision.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 74.3%
  • JavaScript 19.6%
  • Nix 6.1%