Skip to content

Commit

Permalink
add noir-wasm-publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
kevaundray committed Sep 15, 2023
1 parent f0032bb commit b590aa2
Showing 1 changed file with 81 additions and 0 deletions.
81 changes: 81 additions & 0 deletions .github/workflows/release-noir-wasm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Update & Publish

on:
workflow_dispatch:
inputs:
noir-ref:
description: The noir reference to checkout
required: false

jobs:
update-and-publish:
runs-on: ubuntu-22.04

steps:
- name: Checkout
uses: actions/checkout@v3

- uses: actions/checkout@v3
with:
repository: "noir-lang/noir"
ref: ${{ inputs.noir-ref || 'master' }}
path: ".cache/noir"

- name: Collect Revision
id: collect-rev
working-directory: ".cache/noir"
run: |
echo "NOIR_REV_SHORT=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- uses: cachix/install-nix-action@v20
with:
nix_path: nixpkgs=channel:nixpkgs-22.05

- name: Build with Nix
run: |
nix build -L github:noir-lang/noir/master#wasm
- name: Configure git
run: |
git config user.name kobyhallx
git config user.email [email protected]
- name: Copy output
run: |
cp -r $(readlink result)/* .
- name: Update version with git hash
if: ${{ !inputs.noir-ref }}
# This will generate the prerelease with something like `.0` but that is okay because it is proper SemVer
run: |
npm version --no-git-tag-version --preid ${{ steps.collect-rev.outputs.NOIR_REV_SHORT }} prerelease
- name: Commit updates
run: |
git add .
git commit -m "tracking noir@${{ steps.collect-rev.outputs.NOIR_REV_SHORT }}"
git push --force
- name: Publish to npm (nightly tag)
if: ${{ !inputs.noir-ref }}
run: |
npm publish --tag nightly
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Publish to npm (latest tag)
if: ${{ inputs.noir-ref }}
run: |
npm publish --tag latest
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 comments on commit b590aa2

Please sign in to comment.