Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add osx and plugins artifacts #97

Merged
merged 18 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/workflows/artifacts-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Artifacts Publish

on:
push:
tags:
- '*-artifacts'

jobs:
check_tag:
uses: ./.github/workflows/reusable-check-tag.yml
with:
ref: ${{ github.ref }}

publish:
needs: [check_tag]
uses: ./.github/workflows/reusable-publish.yml
with:
package: ${{ needs.check_tag.outputs.package }}
version: ${{ needs.check_tag.outputs.version }}
secrets:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ coverage
.coverage_contracts

# production
artifacts
build
cache
dist
Expand Down
1 change: 1 addition & 0 deletions artifacts/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALCHEMY_API_KEY=your_alchemy_api_key
16 changes: 16 additions & 0 deletions artifacts/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Aragon OSx Commons Artifacts

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## v0.1.0-alpha.1

## Added

- Add osx's contracts artifacts.
- Add admin plugin's contracts artifacts.
- Add multisig plugin's contracts artifacts.
- Add token voting plugin's contracts artifacts.
- Add staged proposal processor plugin's contracts artifacts.
clauBv23 marked this conversation as resolved.
Show resolved Hide resolved
13 changes: 13 additions & 0 deletions artifacts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# @aragon/osx-artifacts

## Installation

```bash
npm install @aragon/osx-artifacts
## or
yarn add @aragon/osx-artifacts
```

## Usage

Import the needed abis from the package.
63 changes: 63 additions & 0 deletions artifacts/generateAbis.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/bin/bash

source .env
export ALCHEMY_API_KEY=$ALCHEMY_API_KEY


clauBv23 marked this conversation as resolved.
Show resolved Hide resolved
current_dir=$(pwd)
CLONE_DIR="temp_dir"

rm -rf $CLONE_DIR
mkdir -p $CLONE_DIR
cd $CLONE_DIR

# The format is the following:
# repoUrl = branchname&artifactsDirectory&projectType&contractsDirectory

REPOS=$(cat <<EOF
https://github.com/aragon/osx=develop&artifacts/src&hardhat&packages/contracts,
https://github.com/aragon/admin-plugin=develop&artifacts/src&hardhat&packages/contracts,
https://github.com/aragon/token-voting-plugin=develop&artifacts/src&hardhat&packages/contracts,
https://github.com/aragon/multisig-plugin=develop&artifacts/src&hardhat&packages/contracts,
https://github.com/aragon/staged-proposal-processor-plugin=init-project&out&forge&
EOF
)

# Process each line
while IFS=',' read -r line; do
IFS='=' read -r repoUrl data <<< "$line"

IFS='&' read -r branch artifactSource projectType contractsDirectory <<< "$data"

REPO_NAME=$(basename $repoUrl .git)

git clone -b ${branch} $repoUrl $REPO_NAME

cd $REPO_NAME/$contractsDirectory

yarn install

yarn add -D @wagmi/cli

if [ "$projectType" = "hardhat" ]; then
cp $current_dir/wagmi.hardhat.config.ts wagmi.config.ts
sed -i -e "s|REPLACE_ARTIFACTS_SOURCE|${artifactSource}|g" wagmi.config.ts
npx hardhat compile

elif [ "$projectType" = "forge" ]; then
cp $current_dir/wagmi.foundry.config.ts wagmi.config.ts
forge remappings
forge compile

else
echo "either hardhat or forge project is required"
exit 1
fi

yarn wagmi generate

mv generated/abis.ts $current_dir/src/abis/${REPO_NAME}-abis.ts

cd $current_dir/$CLONE_DIR

done <<< "$REPOS"
clauBv23 marked this conversation as resolved.
Show resolved Hide resolved
32 changes: 32 additions & 0 deletions artifacts/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions artifacts/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "@aragon/osx-commons-artifacts",
"author": "Aragon X",
"version": "0.1.0-alpha.1",
"license": "AGPL-3.0-or-later",
"description": "The Aragon OSx Solidity contracts ABIs",
"typings": "dist/index.d.ts",
"main": "dist/index.js",
"files": [
"dist"
],
"publishConfig": {
"access": "public"
},
"scripts": {
"build": "tsc",
"generate": "sh generateAbis.sh"
},
"engines": {
"node": "^14.0.0 || ^16.0.0 || ^18.0.0"
},
"devDependencies": {
"typescript": "^5.5.4",
"@wagmi/cli": "^2.1.15"

}
}
Loading
Loading