diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml index 23ae0e409e9..cdebb2b8bcc 100644 --- a/.github/workflows/build-docs.yml +++ b/.github/workflows/build-docs.yml @@ -2,12 +2,6 @@ name: Build docs on: pull_request: - paths: - - 'docs/**' - types: - - opened - - synchronize - - labeled jobs: add_label: @@ -53,7 +47,7 @@ jobs: }) } - deploy_docs: + build_and_deploy: runs-on: ubuntu-latest permissions: pull-requests: write @@ -62,81 +56,32 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v2 - - - name: Netlify deploy - run: | - BRANCH_NAME=$(echo "${{ github.head_ref || github.ref }}" | sed -e "s#refs/[^/]*/##") - curl -X POST -d {} "https://api.netlify.com/build_hooks/${{ secrets.NETLIFY_BUILD_HOOK }}?trigger_branch=$BRANCH_NAME" - - name: Get deploy preview - id: get_deploy_preview - run: | - BRANCH_NAME=$(echo "${{ github.head_ref || github.ref }}" | sed -e "s#refs/[^/]*/##") - curl -X GET "https://api.netlify.com/api/v1/sites/${{ secrets.NETLIFY_SITE_ID }}/deploys?branch=$BRANCH_NAME" > deploy.json - echo "::set-output name=deploy_url::$(cat deploy.json | jq -r '.[0].deploy_ssl_url')" - - - name: Add PR Comment - uses: mshick/add-pr-comment@v2 - with: - message: | - Hey @${{ github.event.pull_request.user.login }}! 🙌 - - I'm the deployment bot for Noir Docs, and I've got some updates for you: - - ## Deployment Status - Your latest changes are being deployed for preview! 🚀 - - Click the badge to see logs 🧐 - - [![Netlify Status](https://api.netlify.com/api/v1/badges/${{ secrets.NETLIFY_SITE_ID }}/deploy-status?branch=${{ github.head_ref || github.ref }})](https://app.netlify.com/sites/noir-docs-v2/deploys) - - If you have any questions about this process, refer to our contribution guide or feel free to ask around. - - - - name: Check on deploy status - uses: ./.github/actions/docs/build-status - id: check_deploy_status - with: - branch-name: ${{ github.head_ref || github.ref }} - site-id: ${{ secrets.NETLIFY_SITE_ID }} - continue-on-error: true - - - - name: Debugging - print deploy_status - run: echo "${{ steps.check_deploy_status.outputs.deploy_status }}" - - - - name: Change PR Comment for Successful Deployment - if: steps.check_deploy_status.outputs.deploy_status == 'success' - uses: mshick/add-pr-comment@v2 + + - name: Setup Node.js + uses: actions/setup-node@v2 with: - message-success: | - ![It's Alive!](https://i.imgflip.com/82hw5n.jpg) - - I'm a bot, beep boop 🤖 - - ## Deployment Status: Success! - [![Netlify Status](https://api.netlify.com/api/v1/badges/${{ secrets.NETLIFY_SITE_ID }}/deploy-status?branch=${{ github.head_ref || github.ref }})](https://app.netlify.com/sites/noir-docs-v2/deploys) - - ## Preview - - 🌐 [View Deployment Preview](${{ steps.get_deploy_preview.outputs.deploy_url }}) - + node-version: '18' - - - name: Change PR Comment for Failed Deployment - if: steps.check_deploy_status.outputs.deploy_status == 'failure' - uses: mshick/add-pr-comment@v2 + - name: Install dependencies + run: yarn + + - name: Build docs + run: yarn workspace docs build + + - name: Remove pre-releases + working-directory: docs + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: yarn setStable + + - name: Deploy to Netlify + uses: nwtgck/actions-netlify@v2.1 with: - message: | - ![docs CI troll](https://i.imgflip.com/82ht8f.jpg) - - I'm a bot, beep boop 🤖 - - ## Deployment Status: Failed ❌ - Deployment didn't succeed. Please check logs below and resolve the issue 🧐 - - [![Netlify Status](https://api.netlify.com/api/v1/badges/${{ secrets.NETLIFY_SITE_ID }}/deploy-status?branch=${{ github.head_ref || github.ref }})](https://app.netlify.com/sites/noir-docs-v2/deploys) - - - name: Fail the workflow if deployment failed - if: steps.check_deploy_status.outputs.deploy_status == 'failure' - run: exit 1 + publish-dir: './docs/build' + github-token: ${{ secrets.GITHUB_TOKEN }} + enable-github-deployment: false + deploy-message: "Deploy from GitHub Actions for PR ${{ github.event.number }}" + env: + NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} + NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} + timeout-minutes: 1 diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml index 2de546adec7..4c20c9181db 100644 --- a/.github/workflows/publish-docs.yml +++ b/.github/workflows/publish-docs.yml @@ -23,13 +23,21 @@ jobs: uses: actions/setup-node@v2 with: node-version: '18' + + - name: Install Yarn + run: npm install -g yarn - name: Install Yarn dependencies - uses: ./.github/actions/setup + run: yarn - name: Cut a new version working-directory: ./docs run: yarn docusaurus docs:version ${{ inputs.tag }} + + - name: Remove pre-releases + id: get_version + run: | + cd docs && yarn setStable - name: Build docs run: yarn workspace docs build @@ -39,7 +47,7 @@ jobs: with: publish-dir: './docs/build' production-branch: master - production-deploy: false # TODO change to true + production-deploy: true github-token: ${{ secrets.GITHUB_TOKEN }} enable-github-deployment: false deploy-message: "Deploy from GitHub Actions for tag ${{ inputs.tag }}" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2786bc32970..d785eefbc14 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -77,4 +77,20 @@ jobs: workflow: publish-es-packages.yml ref: master token: ${{ secrets.NOIR_REPO_TOKEN }} - inputs: '{ "noir-ref": "${{ needs.release-please.outputs.tag-name }}", "npm-tag": "latest" }' \ No newline at end of file + inputs: '{ "noir-ref": "${{ needs.release-please.outputs.tag-name }}", "npm-tag": "latest" }' + + + publish-docs: + name: Publish docs + needs: [release-please] + if: ${{ needs.release-please.outputs.tag-name }} + runs-on: ubuntu-latest + steps: + - name: Dispatch to publish workflow + uses: benc-uk/workflow-dispatch@v1 + with: + workflow: publish-docs.yml + repo: noir-lang/noir + ref: master + token: ${{ secrets.GITHUB_TOKEN }} + inputs: '{ "tag": "${{ needs.release-please.outputs.tag-name }}"}' diff --git a/docs/.gitignore b/docs/.gitignore index 96ecf9cbc03..c034d49ebde 100644 --- a/docs/.gitignore +++ b/docs/.gitignore @@ -20,4 +20,4 @@ npm-debug.log* yarn-debug.log* yarn-error.log* -package-lock.json +package-lock.json \ No newline at end of file diff --git a/docs/docs/nargo/04_language_server.md b/docs/docs/nargo/04_language_server.md index 144cd249c4b..48c01465f6e 100644 --- a/docs/docs/nargo/04_language_server.md +++ b/docs/docs/nargo/04_language_server.md @@ -27,12 +27,12 @@ Currently, Noir provides a Language Client for Visual Studio Code via the [vscod When your language server is running correctly and the VSCode plugin is installed, you should see handy codelens buttons for compilation, measuring circuit size, execution, and tests: -![Compile and Execute](./../../static/img/codelens_compile_execute.png) -![Run test](../../static/img/codelens_run_test.png) +![Compile and Execute](@site/static/img/codelens_compile_execute.png) +![Run test](@site/static/img/codelens_run_test.png) You should also see your tests in the `testing` panel: -![Testing panel](./../../static/img/codelens_testing_panel.png) +![Testing panel](@site/static/img/codelens_testing_panel.png) ### Configuration diff --git a/docs/docs/noir_js/getting_started/01_tiny_noir_app.md b/docs/docs/noir_js/getting_started/01_tiny_noir_app.md index 82d18ab5cad..c51ed61de52 100644 --- a/docs/docs/noir_js/getting_started/01_tiny_noir_app.md +++ b/docs/docs/noir_js/getting_started/01_tiny_noir_app.md @@ -237,7 +237,7 @@ You're probably eager to see stuff happening, so go and run your app now! From your terminal, run `npm start` (or `yarn start`). If it doesn't open a browser for you, just visit `localhost:5173`. On a modern laptop, proof will generate in less than 100ms, and you'll see this: -![Getting Started 0](./../../../static/img/noir_getting_started_1.png) +![Getting Started 0](@site/static/img/noir_getting_started_1.png) If you're human, you shouldn't be able to understand anything on the "proof" box. That's OK. We like you, human. diff --git a/docs/docusaurus.config.js b/docs/docusaurus.config.js index ff07b5697ce..5128a99b000 100644 --- a/docs/docusaurus.config.js +++ b/docs/docusaurus.config.js @@ -45,9 +45,6 @@ const config = { label: 'dev', path: 'dev', }, - '0.7.1': { - label: '0.7.1 / 0.8.0', - }, }, editUrl: ({ versionDocsDirPath, docPath }) => `https://github.com/noir-lang/noir/edit/master/docs/${versionDocsDirPath}/${docPath}`, @@ -62,7 +59,7 @@ const config = { themeConfig: /** @type {import('@docusaurus/preset-classic').ThemeConfig} */ - ({ + { // Replace with your project's social card navbar: { logo: { @@ -87,8 +84,7 @@ const config = { metadata: [ { name: 'Noir', - content: - 'noir, programming, language, documentation, zk, zero-knowledge, l2, crypto, layer2, ethereum', + content: 'noir, programming, language, documentation, zk, zero-knowledge, l2, crypto, layer2, ethereum', }, ], footer: { @@ -149,7 +145,7 @@ const config = { indexName: 'noir-lang', }, - }), + }, }; module.exports = config; diff --git a/docs/package.json b/docs/package.json index edf4bba0686..3d71493c0ff 100644 --- a/docs/package.json +++ b/docs/package.json @@ -4,7 +4,8 @@ "private": true, "scripts": { "start": "docusaurus start", - "build": "docusaurus build" + "build": "docusaurus build", + "setStable": "node ./scripts/setStable.js" }, "dependencies": { "@docusaurus/core": "^2.4.0", diff --git a/docs/scripts/setStable.js b/docs/scripts/setStable.js new file mode 100644 index 00000000000..d0954cd6708 --- /dev/null +++ b/docs/scripts/setStable.js @@ -0,0 +1,41 @@ +/* eslint-disable */ +const fs = require('fs'); +const path = require('path'); +const axios = require('axios'); +const { release } = require('os'); + +const IGNORE_VERSIONS = ['0.16.0']; +const NUMBER_OF_VERSIONS_TO_SHOW = 2; + +async function main() { + const versionsFile = path.join(__dirname, '../versions.json'); + + const axiosOpts = { + params: { per_page: 100 }, + }; + + console.log(process.env.GITHUB_TOKEN); + // cool if you have a GITHUB_TOKEN because of rate limiting + // but fine if you don't + if (process.env.GITHUB_TOKEN) axiosOpts.headers = { Authorization: `token ${process.env.GITHUB_TOKEN}` }; + + const { data } = await axios.get('https://api.github.com/repos/noir-lang/noir/releases', axiosOpts); + + const all = data.map((release) => release.tag_name); + console.log('All versions: ', all); + const aztecs = data.filter((release) => release.tag_name.includes('aztec')).map((release) => release.tag_name); + console.log('Removing aztecs: ', aztecs); + const prereleases = data.filter((release) => !release.prerelease).map((release) => release.tag_name); + console.log('Removing prereleases: ', prereleases); + + const stables = data + .filter((release) => !release.prerelease && !release.tag_name.includes('aztec')) + .filter((release) => !IGNORE_VERSIONS.includes(release.tag_name.replace('v', ''))) + .map((release) => release.tag_name.replace('v', '')) + .slice(0, NUMBER_OF_VERSIONS_TO_SHOW); + + console.log('Stables: ', stables); + fs.writeFileSync(versionsFile, JSON.stringify(stables, null, 2)); +} + +main(); diff --git a/docs/versioned_docs/version-0.10.5/getting_started/03_language_server.md b/docs/versioned_docs/version-0.10.5/getting_started/03_language_server.md index f2de55cfb7c..49bd1d24675 100644 --- a/docs/versioned_docs/version-0.10.5/getting_started/03_language_server.md +++ b/docs/versioned_docs/version-0.10.5/getting_started/03_language_server.md @@ -25,8 +25,8 @@ Currently, Noir provides a Language Client for Visual Studio Code via the [vscod When you language server is running correctly and the VSCode plugin is installed, you should see handy codelens buttons for compilation, execution, and tests: -![Compile and Execute](./../../../static/img/codelens_compile_execute.png) -![Run test](../../../static/img/codelens_run_test.png) +![Compile and Execute](@site/static/img/codelens_compile_execute.png) +![Run test](@site/static/img/codelens_run_test.png) ### Configuration diff --git a/docs/versioned_docs/version-0.17.0/language_concepts/data_types/05_slices.mdx b/docs/versioned_docs/version-0.17.0/language_concepts/data_types/05_slices.mdx index 0d599ab7b24..f45f56daee1 100644 --- a/docs/versioned_docs/version-0.17.0/language_concepts/data_types/05_slices.mdx +++ b/docs/versioned_docs/version-0.17.0/language_concepts/data_types/05_slices.mdx @@ -4,7 +4,7 @@ description: Explore the Slice data type in Noir. Understand its methods, see re keywords: [noir, slice type, methods, examples, subarrays] --- -import Experimental from '../../../../src/components/Notes/_experimental.mdx'; +import Experimental from '@site/src/components/Notes/_experimental.mdx'; diff --git a/docs/versioned_docs/version-0.17.0/language_concepts/data_types/06_vectors.mdx b/docs/versioned_docs/version-0.17.0/language_concepts/data_types/06_vectors.mdx index 75a44f6f78e..4617e90d038 100644 --- a/docs/versioned_docs/version-0.17.0/language_concepts/data_types/06_vectors.mdx +++ b/docs/versioned_docs/version-0.17.0/language_concepts/data_types/06_vectors.mdx @@ -4,7 +4,7 @@ description: Delve into the Vector data type in Noir. Learn about its methods, p keywords: [noir, vector type, methods, examples, dynamic arrays] --- -import Experimental from '../../../../src/components/Notes/_experimental.mdx'; +import Experimental from '@site/src/components/Notes/_experimental.mdx'; diff --git a/docs/versioned_docs/version-0.17.0/nargo/04_language_server.md b/docs/versioned_docs/version-0.17.0/nargo/04_language_server.md index 03e81044b9c..48c01465f6e 100644 --- a/docs/versioned_docs/version-0.17.0/nargo/04_language_server.md +++ b/docs/versioned_docs/version-0.17.0/nargo/04_language_server.md @@ -27,12 +27,12 @@ Currently, Noir provides a Language Client for Visual Studio Code via the [vscod When your language server is running correctly and the VSCode plugin is installed, you should see handy codelens buttons for compilation, measuring circuit size, execution, and tests: -![Compile and Execute](./../../../static/img/codelens_compile_execute.png) -![Run test](../../../static/img/codelens_run_test.png) +![Compile and Execute](@site/static/img/codelens_compile_execute.png) +![Run test](@site/static/img/codelens_run_test.png) You should also see your tests in the `testing` panel: -![Testing panel](./../../../static/img/codelens_testing_panel.png) +![Testing panel](@site/static/img/codelens_testing_panel.png) ### Configuration diff --git a/docs/versioned_docs/version-0.17.0/noir_js/getting_started/01_tiny_noir_app.md b/docs/versioned_docs/version-0.17.0/noir_js/getting_started/01_tiny_noir_app.md index 876d308d650..6955f7a1e64 100644 --- a/docs/versioned_docs/version-0.17.0/noir_js/getting_started/01_tiny_noir_app.md +++ b/docs/versioned_docs/version-0.17.0/noir_js/getting_started/01_tiny_noir_app.md @@ -235,7 +235,7 @@ You're probably eager to see stuff happening, so go and run your app now! From your terminal, run `npm start` (or `yarn start`). If it doesn't open a browser for you, just visit `localhost:5173`. On a modern laptop, proof will generate in less than 100ms, and you'll see this: -![Getting Started 0](./../../../../static/img/noir_getting_started_1.png) +![Getting Started 0](@site/static/img/noir_getting_started_1.png) If you're human, you shouldn't be able to understand anything on the "proof" box. That's OK. We like you, human. diff --git a/docs/versioned_docs/version-0.17.0/standard_library/cryptographic_primitives/00_hashes.mdx b/docs/versioned_docs/version-0.17.0/standard_library/cryptographic_primitives/00_hashes.mdx index be780125ac5..2cc3cd81e4e 100644 --- a/docs/versioned_docs/version-0.17.0/standard_library/cryptographic_primitives/00_hashes.mdx +++ b/docs/versioned_docs/version-0.17.0/standard_library/cryptographic_primitives/00_hashes.mdx @@ -7,7 +7,7 @@ keywords: [cryptographic primitives, Noir project, sha256, blake2s, pedersen, mimc_bn254, mimc, hash] --- -import BlackBoxInfo from '../../../../src/components/Notes/_blackbox.mdx'; +import BlackBoxInfo from '@site/src/components/Notes/_blackbox.mdx'; ## sha256 diff --git a/docs/versioned_docs/version-0.17.0/standard_library/cryptographic_primitives/01_scalar.mdx b/docs/versioned_docs/version-0.17.0/standard_library/cryptographic_primitives/01_scalar.mdx index f48d45a5816..c7eed820a80 100644 --- a/docs/versioned_docs/version-0.17.0/standard_library/cryptographic_primitives/01_scalar.mdx +++ b/docs/versioned_docs/version-0.17.0/standard_library/cryptographic_primitives/01_scalar.mdx @@ -4,7 +4,7 @@ description: See how you can perform scalar multiplications over a fixed base in keywords: [cryptographic primitives, Noir project, scalar multiplication] --- -import BlackBoxInfo from '../../../../src/components/Notes/_blackbox.mdx'; +import BlackBoxInfo from '@site/src/components/Notes/_blackbox.mdx'; ## scalar_mul::fixed_base_embedded_curve diff --git a/docs/versioned_docs/version-0.17.0/standard_library/cryptographic_primitives/02_schnorr.mdx b/docs/versioned_docs/version-0.17.0/standard_library/cryptographic_primitives/02_schnorr.mdx index 61770d71cd8..c184ce28120 100644 --- a/docs/versioned_docs/version-0.17.0/standard_library/cryptographic_primitives/02_schnorr.mdx +++ b/docs/versioned_docs/version-0.17.0/standard_library/cryptographic_primitives/02_schnorr.mdx @@ -4,7 +4,7 @@ description: Learn how you can verify Schnorr signatures using Noir keywords: [cryptographic primitives, Noir project, schnorr, signatures] --- -import BlackBoxInfo from '../../../../src/components/Notes/_blackbox.mdx'; +import BlackBoxInfo from '@site/src/components/Notes/_blackbox.mdx'; ## schnorr::verify_signature diff --git a/docs/versioned_docs/version-0.17.0/standard_library/cryptographic_primitives/03_ecdsa_sig_verification.mdx b/docs/versioned_docs/version-0.17.0/standard_library/cryptographic_primitives/03_ecdsa_sig_verification.mdx index 1a2f2ef13e2..72bce984821 100644 --- a/docs/versioned_docs/version-0.17.0/standard_library/cryptographic_primitives/03_ecdsa_sig_verification.mdx +++ b/docs/versioned_docs/version-0.17.0/standard_library/cryptographic_primitives/03_ecdsa_sig_verification.mdx @@ -4,7 +4,7 @@ description: Learn about the cryptographic primitives regarding ECDSA over the s keywords: [cryptographic primitives, Noir project, ecdsa, secp256k1, secp256r1, signatures] --- -import BlackBoxInfo from '../../../../src/components/Notes/_blackbox.mdx'; +import BlackBoxInfo from '@site/src/components/Notes/_blackbox.mdx'; Noir supports ECDSA signatures verification over the secp256k1 and secp256r1 curves. diff --git a/docs/versioned_docs/version-0.17.0/standard_library/cryptographic_primitives/05_eddsa.mdx b/docs/versioned_docs/version-0.17.0/standard_library/cryptographic_primitives/05_eddsa.mdx index 49df8796105..9a5beb55ee9 100644 --- a/docs/versioned_docs/version-0.17.0/standard_library/cryptographic_primitives/05_eddsa.mdx +++ b/docs/versioned_docs/version-0.17.0/standard_library/cryptographic_primitives/05_eddsa.mdx @@ -4,7 +4,7 @@ description: Learn about the cryptographic primitives regarding EdDSA keywords: [cryptographic primitives, Noir project, eddsa, signatures] --- -import BlackBoxInfo from '../../../../src/components/Notes/_blackbox.mdx'; +import BlackBoxInfo from '@site/src/components/Notes/_blackbox.mdx'; ## eddsa::eddsa_poseidon_verify diff --git a/docs/versions.json b/docs/versions.json index 872105b2fb4..e1a95eeb06d 100644 --- a/docs/versions.json +++ b/docs/versions.json @@ -1,7 +1,4 @@ [ "0.17.0", - "0.10.5", - "0.9.0", - "0.7.1", - "0.6.0" -] + "0.10.5" +] \ No newline at end of file