Skip to content

Commit

Permalink
Merge pull request #97 from aragon/feat/add-osx-and-plugins-artifacts
Browse files Browse the repository at this point in the history
feat: add osx and plugins artifacts
  • Loading branch information
clauBv23 authored Aug 7, 2024
2 parents 0d84913 + 07bec06 commit f6d0364
Show file tree
Hide file tree
Showing 20 changed files with 8,900 additions and 2 deletions.
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: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
.coverage_artifacts
.coverage_cache
.coverage_contracts
artifacts
build
cache
coverage
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 of version 1.4.0-alpha.1.
- Add admin plugin's contracts artifacts of version 1.2-alpha.1.
- Add multisig plugin's contracts artifacts of version 1.3-alpha.1.
- Add token voting plugin's contracts artifacts of version 1.3-alpha.1.
- Add staged proposal processor plugin's contracts artifacts of version 1.0.0-alpha.1.
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-dev-artifacts

## Installation

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

## Usage

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

source .env

if [ -z "$ALCHEMY_API_KEY" ]
then
echo "ALCHEMY_API_KEY is not set on the .env file, exiting..."
exit -1
else
export ALCHEMY_API_KEY=$ALCHEMY_API_KEY
fi


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"
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.

26 changes: 26 additions & 0 deletions artifacts/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "@aragon/osx-dev-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

0 comments on commit f6d0364

Please sign in to comment.