10
10
overridden_plugin_version :
11
11
required : false
12
12
type : string
13
+ plugin_name :
14
+ required : true
15
+ default : " ${{ inputs.plugin_name }}"
16
+ type : string
13
17
14
18
jobs :
15
19
check-uploaded :
16
- name : Check snforge_scarb_plugin Version
20
+ name : Check ${{ inputs.plugin_name }} Version
17
21
runs-on : ubuntu-latest
18
22
outputs :
19
23
plugin_uploaded : ${{ steps.check-uploaded.outputs.plugin_uploaded }}
@@ -26,14 +30,16 @@ jobs:
26
30
27
31
source scripts/handle_version.sh
28
32
29
- snforge_scarb_plugin_version=$(get_version "${{ inputs.overridden_plugin_version }}")
33
+ plugin_underscores=${{ inputs.plugin_name }}
34
+ plugin_underscores=${plugin_underscores//-/_}
35
+ plugin_version=$(get_version "${{ inputs.overridden_plugin_version }}")
30
36
31
37
registry_url=${{ inputs.prod_registry == true && 'https://scarbs.xyz' || 'https://scarbs.dev' }}
32
- plugin_uploaded=$(curl -s ${registry_url}/api/v1/index/sn/fo/snforge_scarb_plugin .json | jq --arg version "$snforge_scarb_plugin_version " '[.[] | select(.v == $version)] | length > 0')
38
+ plugin_uploaded=$(curl -s ${registry_url}/api/v1/index/sn/fo/${plugin_underscores} .json | jq --arg version "$plugin_version " '[.[] | select(.v == $version)] | length > 0')
33
39
echo "plugin_uploaded=$plugin_uploaded" >> $GITHUB_OUTPUT
34
40
35
41
upload-to-registry :
36
- name : Upload snforge_scarb_plugin to the registry
42
+ name : Upload ${{ inputs.plugin_name }} to the registry
37
43
runs-on : ubuntu-latest
38
44
needs : [check-uploaded]
39
45
env :
42
48
- uses : actions/checkout@v4
43
49
- uses : dtolnay/rust-toolchain@stable
44
50
- uses : software-mansion/setup-scarb@v1
45
- with :
46
- # TODO(#3144) Remove
47
- scarb-version : " 2.11.4"
48
51
49
52
- name : Download artifacts
50
53
uses : actions/download-artifact@v4
@@ -54,27 +57,30 @@ jobs:
54
57
- name : Unpack artifacts to target directory
55
58
run : |
56
59
set -euxo pipefail
57
- mkdir -p crates/snforge-scarb-plugin/target/scarb/cairo-plugin
58
60
59
- mv artifacts-dl/build-plugin-*/snforge_scarb_plugin_v* crates/snforge-scarb-plugin/target/scarb/cairo-plugin/
61
+ plugin_underscores=${{ inputs.plugin_name }}
62
+ plugin_underscores=${plugin_underscores//-/_}
63
+
64
+ mkdir -p crates/${{ inputs.plugin_name }}/target/scarb/cairo-plugin
65
+ mv artifacts-dl/build-*/${plugin_underscores}_v* crates/${{ inputs.plugin_name }}/target/scarb/cairo-plugin/
60
66
61
67
# Required for testing prebuild plugin while creating release.
62
68
if [[ -n "${{ inputs.overridden_plugin_version }}" ]]; then
63
- cd crates/snforge-scarb-plugin /target/scarb/cairo-plugin/
69
+ cd crates/${{ inputs.plugin_name }} /target/scarb/cairo-plugin/
64
70
overridden_version="${{ inputs.overridden_plugin_version }}"
65
71
66
- for file in snforge_scarb_plugin_v *; do
67
- if [[ -f "$file" && ! "$file" =~ "snforge_scarb_plugin_v ${overridden_version}" ]]; then
68
- platform=$(echo "$file" | sed -E 's/snforge_scarb_plugin_v [0-9]+\.[0-9]+\.[0-9]+([-.].*)?_(.+)/\2/' )
69
- new_file="snforge_scarb_plugin_v ${overridden_version}_${platform}"
72
+ for file in ${plugin_underscores}_v *; do
73
+ if [[ -f "$file" && ! "$file" =~ "${plugin_underscores}_v ${overridden_version}" ]]; then
74
+ platform=$(echo "$file" | sed -E "s/${plugin_underscores}_v [0-9]+\.[0-9]+\.[0-9]+([-.].*)?_(.+)/\2/" )
75
+ new_file="${plugin_underscores}_v ${overridden_version}_${platform}"
70
76
mv "$file" "$new_file"
71
77
fi
72
78
done
73
79
fi
74
80
75
- - name : Publish snforge_scarb_plugin
81
+ - name : Publish ${{ inputs.plugin_name }}
76
82
if : needs.check-uploaded.outputs.plugin_uploaded == 'false' || github.event_name == 'workflow_dispatch'
77
- working-directory : crates/snforge-scarb-plugin
83
+ working-directory : crates/${{ inputs.plugin_name }}
78
84
run : |
79
85
set -exo pipefail
80
86
source ../../scripts/handle_version.sh
0 commit comments