-
Notifications
You must be signed in to change notification settings - Fork 232
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f0032bb
commit b590aa2
Showing
1 changed file
with
81 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |