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.
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.jsonThis produces a JSON file like:
{ "rev": "c61573364694a68d9993c8b0fb603b29e7251d79", "sha256": "1s0qrrin8ry9klvjaxj4hd3qlf3cayfisq8pn7idqddgcg0lc079" }See action.yml for all options.
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/v1Your action is now published! 🚀
See the versioning documentation