-
Notifications
You must be signed in to change notification settings - Fork 71
64 lines (55 loc) · 2.77 KB
/
publish_plugins.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
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:
cache: false
scarb-version: ${{ github.ref_name }}
- 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
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