From 2ceea77c3258658a5615d53188291f4143da38dd Mon Sep 17 00:00:00 2001 From: Maarten Zuidhoorn Date: Tue, 21 Mar 2023 11:45:48 +0100 Subject: [PATCH] Deploy registry and signature to gh-pages --- .github/workflows/publish-registry.yml | 39 ++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish-registry.yml b/.github/workflows/publish-registry.yml index c8d35910..7a45002f 100644 --- a/.github/workflows/publish-registry.yml +++ b/.github/workflows/publish-registry.yml @@ -6,11 +6,44 @@ on: jobs: check-updated: + name: Check if registry file was updated runs-on: ubuntu-latest + outputs: + EXIT_CODE: ${{ steps.exit-code.outputs.EXIT_CODE }} steps: - uses: actions/checkout@v3 - name: Check if registry file was updated - id: check-updated + id: exit-code run: | - git diff --name-only HEAD^ HEAD | grep -q registry.json - echo "::set-output name=updated::$?" + git diff --name-only HEAD^ HEAD | grep -q src/registry.json + echo "EXIT_CODE=$?" >> "$GITHUB_OUTPUT" + + publish-registry: + name: Deploy registry to `gh-pages` branch + environment: npm-publish + needs: check-updated + if: ${{ needs.check-updated.outputs.EXIT_CODE == 0 }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Use Node.js + uses: actions/setup-node@v3 + with: + node-version-file: '.nvmrc' + cache: 'yarn' + - name: Install Yarn dependencies + run: yarn --immutable + - name: Sign registry + run: yarn sign + env: + PRIVATE_KEY: ${{ secrets.REGISTRY_PRIVATE_KEY }} + - run: | + mkdir -p dist + cp src/registry.json dist/registry.json + cp src/signature.json dist/signature.json + - name: Deploy registry + uses: peaceiris/actions-gh-pages@de7ea6f8efb354206b205ef54722213d99067935 + with: + personal_token: ${{ secrets.METAMASKBOT_TOKEN }} + publish_dir: ./dist + destination_dir: latest