-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #81 from polywrap/nk/cd
refactor: keep version of all the wrappers 0.1.0
- Loading branch information
Showing
12 changed files
with
201 additions
and
6 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 |
---|---|---|
|
@@ -3,6 +3,7 @@ on: | |
push: | ||
branches: | ||
- main | ||
- dev | ||
pull_request: | ||
|
||
jobs: | ||
|
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,142 @@ | ||
name: Release | ||
on: | ||
workflow_run: | ||
workflows: [CI] | ||
types: [completed] | ||
branches: [main] | ||
|
||
jobs: | ||
GetVersion: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 60 | ||
outputs: | ||
version: ${{ steps.version.outputs.value }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- id: version | ||
name: Get version | ||
run: echo "::set-output name=value::$(cat VERSION | grep v)" | ||
|
||
Github-release: | ||
name: Create Release | ||
runs-on: ubuntu-latest | ||
needs: | ||
- GetVersion | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: print version with needs | ||
run: echo ${{ needs.GetVersion.outputs.version }} | ||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ needs.GetVersion.outputs.version }} | ||
release_name: Release ${{ needs.GetVersion.outputs.version }} | ||
draft: false | ||
prerelease: false | ||
|
||
Deploy-Built-Artifacts: | ||
strategy: | ||
matrix: | ||
package: | ||
- hello-world,hello | ||
- simple-storage,simple-storage | ||
- json-rpc,jsonrpc | ||
- subgraph-query,subgraph | ||
language: | ||
- assemblyscript | ||
- rust | ||
|
||
runs-on: ubuntu-latest | ||
timeout-minutes: 60 | ||
env: | ||
CI: false | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
- name: Read .nvmrc | ||
run: echo ::set-output name=NVMRC::$(cat .nvmrc) | ||
id: nvm | ||
- name: Setup Node.js | ||
uses: actions/setup-node@master | ||
with: | ||
node-version: "${{ steps.nvm.outputs.NVMRC }}" | ||
- name: Get yarn cache directory path | ||
id: yarn-cache-dir-path | ||
run: echo "::set-output name=dir::$(yarn cache dir)" | ||
- uses: actions/cache@v2 | ||
with: | ||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | ||
key: ${{ runner.os }}-yarn-deployments-v1 | ||
restore-keys: | | ||
${{ runner.os }}-yarn-deployments- | ||
# Install packages | ||
- name: Install pinata cli | ||
run: yarn global add pinata-upload-cli | ||
- name: Install ethers cli | ||
run: yarn global add @ethersproject/cli | ||
|
||
# Get Package Metadata | ||
- id: package | ||
name: Get Package Metadata | ||
run: | | ||
echo ::set-output name=name::$(node ./scripts/release/getPackageData.js ${{ matrix.package }} ${{ matrix.language }} 0) | ||
echo ::set-output name=uri::$(node ./scripts/release/getPackageData.js ${{ matrix.package }} ${{ matrix.language }} 1) | ||
# Setup Pinata | ||
- name: Setup Pinata | ||
run: pinata-cli -a ${{ secrets.PINATA_API_KEY }} | ||
|
||
# Fetch Built Wrappers | ||
- uses: dawidd6/action-download-artifact@v2 | ||
with: | ||
github_token: ${{secrets.GITHUB_TOKEN}} | ||
workflow: ci.yml | ||
workflow_conclusion: success | ||
branch: main | ||
event: push | ||
name: ${{ steps.package.outputs.name }}-${{ matrix.language }}-build-artifact | ||
path: ./${{ steps.package.outputs.name }} | ||
- name: create deployments | ||
run: mkdir ./deployments # fails if dir already exists but that's okay | ||
continue-on-error: true | ||
|
||
# Deploy wrappers to IPFS | ||
- name: Deploy current wrapper to IPFS | ||
run: pinata-cli -u ./${{ steps.package.outputs.name }} > ./deployments/${{ steps.package.outputs.name }}.ipfs.txt | ||
- id: ipfs | ||
name: Fetch IPFS CID for current wrapper | ||
run: echo ::set-output name=value::$(node ./scripts/release/getIpfsCid.js "$(cat ./deployments/${{ steps.package.outputs.name }}.ipfs.txt)") | ||
|
||
# Deploy wrappers to ENS | ||
- id: ensExists | ||
name: Check if ens uri exists | ||
run: 'echo ::set-output name=value::$(node ./scripts/release/checkEnsExists.js "$(ethers-ens lookup ${{ steps.package.outputs.uri }} --rpc https://goerli.infura.io/v3/${{ secrets.INFURA_KEY }})")' | ||
|
||
- name: Create ens subdomain uri | ||
uses: Wandalen/[email protected] | ||
with: | ||
command: ethers-ens set-subnode "${{ steps.package.outputs.uri }}" --account ${{ secrets.PRIVATE_KEY }} --rpc https://goerli.infura.io/v3/${{ secrets.INFURA_KEY }} --yes --wait | ||
attempt_limit: 3 | ||
attempt_delay: 20000 | ||
if: ${{ (steps.ensExists.outputs.value == 'false') }} | ||
|
||
- name: Set Resolver for created ens subdomain | ||
uses: Wandalen/[email protected] | ||
with: | ||
command: "ethers-ens set-resolver ${{ steps.package.outputs.uri }} --account ${{ secrets.PRIVATE_KEY }} --rpc https://goerli.infura.io/v3/${{ secrets.INFURA_KEY }} --yes --wait" | ||
attempt_limit: 3 | ||
attempt_delay: 20000 | ||
if: ${{ (steps.ensExists.outputs.value == 'false') }} | ||
|
||
- name: Publish current wrapper to ENS | ||
uses: Wandalen/[email protected] | ||
with: | ||
command: "ethers-ens set-content ${{ steps.package.outputs.uri }} ${{ steps.ipfs.outputs.value }} --account ${{ secrets.PRIVATE_KEY }} --rpc https://goerli.infura.io/v3/${{ secrets.INFURA_KEY }} --yes --wait" | ||
attempt_limit: 3 | ||
attempt_delay: 20000 |
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 @@ | ||
v0.1.0 |
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
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
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
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
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,16 @@ | ||
const argv = process.argv.slice(2); | ||
|
||
if (argv.length !== 1) { | ||
throw Error(`Require 1 arguments, passed: ${argv.length}`); | ||
} | ||
|
||
const str = argv[0]; | ||
const pattern = /Resolver:[\t\n ]*0x([A-Za-z0-9]*)/; | ||
|
||
const match = str.match(pattern); | ||
|
||
if (!match || match.length < 2 || !match[1]) { | ||
console.log("false"); | ||
} else { | ||
console.log("true"); | ||
} |
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,16 @@ | ||
const argv = process.argv.slice(2); | ||
|
||
if (argv.length !== 1) { | ||
throw Error(`Require 1 arguments, passed: ${argv.length}`); | ||
} | ||
|
||
const str = argv[0]; | ||
const pattern = /IpfsHash:[\t\n ]*'([A-Za-z0-9]*)'/; | ||
|
||
const match = str.match(pattern); | ||
|
||
if (!match) { | ||
throw new Error(`No IPFS CID found in deployment log:\n ${str}`); | ||
} | ||
|
||
console.log(match[1]); |
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,19 @@ | ||
const argv = process.argv.slice(2); | ||
|
||
if (argv.length !== 3) { | ||
throw Error(`Require 3 arguments, passed: ${argv.length}`); | ||
} | ||
|
||
const langAlias = { | ||
assemblyscript: "as", | ||
rust: "rs" | ||
} | ||
|
||
const str = argv[0]; | ||
const lang = langAlias[argv[1]]; | ||
const idx = argv[2]; | ||
|
||
const arr = str.split(","); | ||
arr[1] = `${arr[1]}.${lang}.demos.wraplib.eth` | ||
|
||
console.log(arr[parseInt(idx)]); |
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
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