-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add upload to registry workflow for foundry_std (#2461)
<!-- Reference any GitHub issues resolved by this PR --> Closes #2344 Closes #2463 This PR is a part of the stack: -- Add missing info recommended for package uploads (#2460) --> Add github action workflow for automatic registry uploads during release (This PR) ## Introduced changes <!-- A brief description of the changes --> - Updates github workflow to also upload std libraries to scarbs registry during release - Sets snforge_scarb_plugin to specific version downloadable from the registry, as required by scarb ## Checklist <!-- Make sure all of these are complete --> - [X] Linked relevant issue - [X] Updated relevant documentation - [X] Added relevant tests - [X] Performed self-review of the code - [X] Added changes to `CHANGELOG.md` --------- Co-authored-by: kkawula <[email protected]>
- Loading branch information
Showing
3 changed files
with
79 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Publish snforge_scarb_plugin | ||
|
||
on: | ||
workflow_call: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
upload-to-registry: | ||
name: Upload plugin to the registry | ||
runs-on: ubuntu-latest | ||
env: | ||
SCARB_REGISTRY_AUTH_TOKEN: ${{ secrets.SCARB_REGISTRY_AUTH_TOKEN }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Check version | ||
id: check-version | ||
if: ${{ github.event_name != 'workflow_dispatch' }} | ||
run: | | ||
set -exo pipefail | ||
snforge_scarb_plugin_version=$(grep version crates/snforge-scarb-plugin/Scarb.toml | cut -d '"' -f 2) | ||
snforge_scarb_plugin_uploaded=$(curl -s https://scarbs.xyz/api/v1/index/sn/fo/snforge_scarb_plugin.json | jq --arg version "$snforge_scarb_plugin_version" '[.[] | select(.v == $version)] | length > 0') | ||
echo "snforge_scarb_plugin_uploaded=$snforge_scarb_plugin_uploaded" >> $GITHUB_OUTPUT | ||
- uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a | ||
with: | ||
toolchain: stable | ||
|
||
- uses: software-mansion/setup-scarb@v1 | ||
with: | ||
scarb-version: "2.8.5" | ||
|
||
- name: Publish snforge_scarb_plugin | ||
if: ${{ steps.check-version.outputs.snforge_scarb_plugin_uploaded == 'false' || github.event_name == 'workflow_dispatch' }} | ||
working-directory: crates/snforge-scarb-plugin | ||
run: scarb publish |
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,10 @@ | ||
#!/bin/bash | ||
|
||
PLUGIN_FILE_PATH="../crates/snforge-scarb-plugin/Scarb.toml" | ||
SNFORGE_STD_PATH="../snforge_std/Scarb.toml" | ||
|
||
VERSION=$(grep version "$PLUGIN_FILE_PATH" | cut -d '"' -f 2) | ||
|
||
sed -i.bak "/snforge_scarb_plugin/ s/\(snforge_scarb_plugin = \).*/\1\"^${VERSION}\"/" $SNFORGE_STD_PATH | ||
|
||
rm ${SNFORGE_STD_PATH}.bak 2> /dev/null |