Skip to content

Commit

Permalink
fix: workflow (#1079)
Browse files Browse the repository at this point in the history
  • Loading branch information
ericnordelo authored Aug 2, 2024
1 parent 4f1d539 commit 145adc1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
create:

jobs:
update_version:
update_version_and_presets_page:
if: github.ref_type == 'branch' && startsWith(github.ref, 'refs/heads/release-v')
runs-on: ubuntu-latest

Expand Down Expand Up @@ -45,12 +45,15 @@ jobs:
with:
version: "0.1.0"

- name: Build presets artifacts
run: scarb build -p openzeppelin_presets

- name: Update presets page
run: |
class_hash get --json | sed -e '1,4d' | python3 scripts/get_hashes_page.py "$CAIRO_VERSION" \
class_hash get --no-compile --json | python3 scripts/get_hashes_page.py "$CAIRO_VERSION" \
> ./docs/modules/ROOT/pages/utils/_class_hashes.adoc
- name: Auto-commit changes
uses: stefanzweifel/git-auto-commit-action@3ea6ae190baf489ba007f7c92608f33ce20ef04a #v4.16.0
with:
commit_message: Bump version to ${{ env.NEW_VERSION }}
commit_message: Bump version to ${{ env.NEW_VERSION }} and update presets page
6 changes: 5 additions & 1 deletion scripts/get_hashes_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ def generate_doc_file(cmp_version, contracts):
# Avoid the already added contracts in the known order
if contract['name'] in KNOWN_ORDER:
continue
# Avoid adding mocks
# TODO: remove this after mocks are removed from the artifacts built outside tests
if "Mock" in contract['name']:
continue
hashes += f":{contract['name']}-class-hash: {normalize_len(contract['sierra'])}\n"

footer = """// Presets page
Expand All @@ -44,7 +48,7 @@ def generate_doc_file(cmp_version, contracts):

def remove_prefix_from_names(contracts):
for contract in contracts:
contract.update([("name", remove_prefix(contract['name'], 'openzeppelin_'))])
contract.update([("name", remove_prefix(contract['name'], 'openzeppelin_presets_'))])
return contracts


Expand Down

0 comments on commit 145adc1

Please sign in to comment.