Skip to content

Update version and presets page on new release branch #87

Update version and presets page on new release branch

Update version and presets page on new release branch #87

Workflow file for this run

name: Update version and presets page on new release branch
on:
create:
jobs:
update_version_and_presets_page:
if: github.ref_type == 'branch' && startsWith(github.ref, 'refs/heads/release-v')
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Extract current versions
run: |
CURRENT_VERSION=$(grep '^version = ' Scarb.toml | sed 's/version = "\(.*\)"/\1/')
SCARB_VERSION=$(grep 'scarb-version = ' Scarb.toml | sed 's/scarb-version = "\(.*\)"/\1/')
CAIRO_VERSION=$(grep 'cairo-version = ' Scarb.toml | sed 's/cairo-version = "\(.*\)"/\1/')
{
echo "CURRENT_VERSION=$CURRENT_VERSION"
echo "SCARB_VERSION=$SCARB_VERSION"
echo "CAIRO_VERSION=$CAIRO_VERSION"
} >> "$GITHUB_ENV"
- name: Extract new version number
run: echo "NEW_VERSION=${GITHUB_REF#refs/heads/release-v}" >> "$GITHUB_ENV"
- name: Replace version in files
run: |
echo "Current version: $CURRENT_VERSION"
echo "New version: $NEW_VERSION"
ESCAPED_CURRENT_VERSION="${CURRENT_VERSION//\./\\.}"
find . -type f -not -path '*/\.*' -not -path './CHANGELOG.md' -not -path './docs/package-lock.json' \
-not -path './RELEASING.md' -exec sed -i "s/$ESCAPED_CURRENT_VERSION/$NEW_VERSION/g" {} +
- name: Setup scarb
uses: software-mansion/setup-scarb@v1
id: setup_scarb
with:
scarb-version: ${{ env.SCARB_VERSION }}
- name: Setup class_hash
uses: ericnordelo/setup-class-hash@c14dd33506c3eb8e1acfe2ade9f82585f5acf28c
with:
version: "0.1.0"
- name: Build presets artifacts
run: scarb build -p openzeppelin_presets
- name: Update presets page
run: |
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@8621497c8c39c72f3e2a999a26b4ca1b5058a842 #v5.0.1
with:
commit_message: Bump version to ${{ env.NEW_VERSION }} and update presets page