-
Notifications
You must be signed in to change notification settings - Fork 67
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
Add CI to publish builtin plugins #1648
base: main
Are you sure you want to change the base?
Changes from all commits
29daaac
eebc8ea
57a424d
e8171fe
98cdaf7
084a39c
cf5ecf6
601aaef
b9167c2
5b53314
5277552
b0826b7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: Publish Built-in Plugins | ||
on: | ||
release: | ||
types: | ||
- published | ||
|
||
jobs: | ||
publish: | ||
name: Publish plugins | ||
runs-on: ubuntu-latest | ||
env: | ||
SCARB_REGISTRY_AUTH_TOKEN: ${{ secrets.SCARB_REGISTRY_AUTH_TOKEN }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: software-mansion/setup-scarb@v1 | ||
with: | ||
scarb-version: ${{ github.ref_name }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Won't this be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Afaik,
|
||
|
||
- name: Init Scarb to cache plugins | ||
id: scarb-init | ||
run: | | ||
set -eo pipefail | ||
mkdir -p $HOME/pkg | ||
pushd $HOME/pkg | ||
scarb init --no-vcs | ||
echo "CAIRO_VERSION=$(scarb metadata --format-version 1 | jq -r '.app_version_info.cairo.version')" >> $GITHUB_OUTPUT | ||
env: | ||
SCARB_INIT_TEST_RUNNER: cairo-test | ||
|
||
- name: Check if plugin versions exist in the registry | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need to check it here? Can't we just try to publish and let the pipeline fail if it has already been uploaded? (Generally it expect it not to be, right?) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Since some Cairo versions correspond to multiple Scarb versions, this is likely to happen from time to time.
I think this is the question of deciding how do we want the action to resolve in such instances. We can |
||
id: check-plugins | ||
run: | | ||
set -eo pipefail | ||
echo "assert_macros_exists=$(curl -s https://scarbs.xyz/api/v1/index/as/se/assert_macros.json | jq --arg version "${{ steps.scarb-init.outputs.CAIRO_VERSION }}" '[.[] | select(.v == $version)] | length > 0')" >> $GITHUB_OUTPUT | ||
echo "cairo_run_exists=$(curl -s https://scarbs.xyz/api/v1/index/ca/ir/cairo_run.json | jq --arg version "${{ steps.scarb-init.outputs.CAIRO_VERSION }}" '[.[] | select(.v == $version)] | length > 0')" >> $GITHUB_OUTPUT | ||
echo "starknet_exists=$(curl -s https://scarbs.xyz/api/v1/index/st/ar/starknet.json | jq --arg version "${{ steps.scarb-init.outputs.CAIRO_VERSION }}" '[.[] | select(.v == $version)] | length > 0')" >> $GITHUB_OUTPUT | ||
echo "cairo_test_exists=$(curl -s https://scarbs.xyz/api/v1/index/ca/ir/cairo_test.json | jq --arg version "${{ steps.scarb-init.outputs.CAIRO_VERSION }}" '[.[] | select(.v == $version)] | length > 0')" >> $GITHUB_OUTPUT | ||
|
||
- name: Publish starknet | ||
if: steps.check-plugins.outputs.starknet_exists != 'true' | ||
run: | | ||
pushd $(scarb cache path)/registry/std/v${{ steps.scarb-init.outputs.CAIRO_VERSION }}/starknet | ||
scarb publish | ||
|
||
- name: Publish cairo_run | ||
if: steps.check-plugins.outputs.cairo_run_exists != 'true' | ||
run: | | ||
pushd $(scarb cache path)/registry/std/v${{ steps.scarb-init.outputs.CAIRO_VERSION }}/cairo_run | ||
scarb publish | ||
|
||
- name: Publish cairo_test | ||
if: steps.check-plugins.outputs.cairo_test_exists != 'true' | ||
run: | | ||
pushd $(scarb cache path)/registry/std/v${{ steps.scarb-init.outputs.CAIRO_VERSION }}/test_plugin | ||
scarb publish | ||
|
||
- name: Publish assert_macros | ||
if: steps.check-plugins.outputs.assert_macros_exists != 'true' | ||
run: | | ||
pushd $(scarb cache path)/registry/std/v${{ steps.scarb-init.outputs.CAIRO_VERSION }}/assert_macros | ||
scarb publish |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What token do you think we should keep in our GitHub secrets? Do we want to use some sort of an organization account, or will my personal token do for now? :D
Also, do you think we need any expiration date for it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your personal will do. One year rotation seems alright.